mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 16:15:02 +00:00
fix: calculate percentage received and delivered considering over-receipt and over-delivery (#43870)
This commit is contained in:
@@ -585,7 +585,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)
|
||||
|
||||
@@ -586,7 +586,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