Merge pull request #45204 from frappe/mergify/bp/develop/pr-45197

fix: precision loss causing process loss variance (backport #45197)
This commit is contained in:
rohitwaghchaure
2025-01-10 12:00:37 +05:30
committed by GitHub

View File

@@ -499,7 +499,7 @@ class StockEntry(StockController):
if not self.process_loss_qty:
continue
if fg_completed_qty != (flt(fg_item_qty) + flt(self.process_loss_qty, precision)):
if fg_completed_qty != (flt(fg_item_qty, precision) + flt(self.process_loss_qty, precision)):
frappe.throw(
_(
"Since there is a process loss of {0} units for the finished good {1}, you should reduce the quantity by {0} units for the finished good {1} in the Items Table."
@@ -628,7 +628,9 @@ class StockEntry(StockController):
completed_qty = (
d.completed_qty + d.process_loss_qty + (allowance_percentage / 100 * d.completed_qty)
)
if total_completed_qty > flt(completed_qty):
if flt(total_completed_qty, self.precision("fg_completed_qty")) > flt(
completed_qty, self.precision("fg_completed_qty")
):
job_card = frappe.db.get_value("Job Card", {"operation_id": d.name}, "name")
if not job_card:
frappe.throw(