fix: calculate percentage received and delivered considering over-receipt and over-delivery (backport #43870) (#44030)

fix: calculate percentage received and delivered considering over-receipt and over-delivery (#43870)

(cherry picked from commit adba1168c1)

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
mergify[bot]
2024-11-08 12:24:21 +05:30
committed by GitHub
parent 6dcd015a39
commit 5958d0c257
2 changed files with 2 additions and 2 deletions

View File

@@ -581,7 +581,7 @@ class PurchaseOrder(BuyingController):
def update_receiving_percentage(self): def update_receiving_percentage(self):
total_qty, received_qty = 0.0, 0.0 total_qty, received_qty = 0.0, 0.0
for item in self.items: for item in self.items:
received_qty += item.received_qty received_qty += min(item.received_qty, item.qty)
total_qty += item.qty total_qty += item.qty
if total_qty: if total_qty:
self.db_set("per_received", flt(received_qty / total_qty) * 100, update_modified=False) self.db_set("per_received", flt(received_qty / total_qty) * 100, update_modified=False)

View File

@@ -584,7 +584,7 @@ class SalesOrder(SellingController):
item_delivered_qty = item_delivered_qty[0][0] if item_delivered_qty else 0 item_delivered_qty = item_delivered_qty[0][0] if item_delivered_qty else 0
item.db_set("delivered_qty", flt(item_delivered_qty), update_modified=False) item.db_set("delivered_qty", flt(item_delivered_qty), update_modified=False)
delivered_qty += item.delivered_qty delivered_qty += min(item.delivered_qty, item.qty)
tot_qty += item.qty tot_qty += item.qty
if tot_qty != 0: if tot_qty != 0: