Commit b7cbb306 by Solo Group

pln

1 parent f7a10959
......@@ -224,18 +224,24 @@ def purchase(request, data, **kwargs):
ar_invoice_det.amt_sell = vendor_produk.produk.harga
flush_row(ar_invoice_det)
result = build_purchase(vendor_produk, ar_invoice_det)
total = "price" in result and result["price"] or 0
if total:
if vendor_produk.produk.harga < total:
total += vendor_produk.produk.harga
prod.update(dict(total=result["price"]))
# ar_invoice_det.status = 'status' in result and result["status"] or 'FAILED'
if result["code"] == 9:
ar_invoice_det.amt_buy = result["response"].total
discount = 0
prod.update(
dict(
subtotal=ar_invoice_det.amt_sell,
discount=discount,
total=ar_invoice_det.amt_sell + discount
)
)
prod.update(status=result["status"])
# if result["code"] == 9:
# ar_invoice_det.amt_buy = result["response"].total
# discount = 0
# prod.update(
# dict(
# subtotal=ar_invoice_det.amt_sell,
# discount=discount,
# total=ar_invoice_det.amt_sell + discount
# )
# )
# prod.update(status=result["status"])
r_prod.append(prod)
ar_invoice.payment["response"] = r_prod
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!