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:
@@ -581,7 +581,7 @@ class PurchaseOrder(BuyingController):
|
||||
def update_receiving_percentage(self):
|
||||
total_qty, received_qty = 0.0, 0.0
|
||||
for item in self.items:
|
||||
received_qty += item.received_qty
|
||||
received_qty += min(item.received_qty, item.qty)
|
||||
total_qty += item.qty
|
||||
if total_qty:
|
||||
self.db_set("per_received", flt(received_qty / total_qty) * 100, update_modified=False)
|
||||
|
||||
@@ -584,7 +584,7 @@ class SalesOrder(SellingController):
|
||||
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)
|
||||
|
||||
delivered_qty += item.delivered_qty
|
||||
delivered_qty += min(item.delivered_qty, item.qty)
|
||||
tot_qty += item.qty
|
||||
|
||||
if tot_qty != 0:
|
||||
|
||||
Reference in New Issue
Block a user