Skip to content

Commit

Permalink
fix: precision loss causing process loss variance
Browse files Browse the repository at this point in the history
  • Loading branch information
FathihMohammed committed Jan 9, 2025
1 parent ef3e442 commit d84601b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions erpnext/stock/doctype/stock_entry/stock_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def validate_fg_completed_qty(self):
if self.process_loss_qty:
total += flt(self.process_loss_qty, precision)

if self.fg_completed_qty != total:
if self.fg_completed_qty != flt(total, precision):
frappe.throw(
_(
"The finished product {0} quantity {1} and For Quantity {2} cannot be different"
Expand Down Expand Up @@ -610,7 +610,9 @@ def check_if_operations_completed(self):
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(
Expand Down

0 comments on commit d84601b

Please sign in to comment.