mirror of
https://github.com/frappe/erpnext.git
synced 2026-10-29 22:57:42 +00:00
fix(stock): enhance quantity tolerance handling in disassembly process
(cherry picked from commit a8b58e3f78)
# Conflicts:
# erpnext/stock/doctype/stock_entry/services/disassemble.py
This commit is contained in:
@@ -1108,6 +1108,7 @@ class StockEntry(StockController):
|
||||
|
||||
precision = frappe.get_precision("Stock Entry Detail", "transfer_qty")
|
||||
tolerance = _qty_tolerance(precision)
|
||||
qty_tolerance = _qty_tolerance(frappe.get_precision("Stock Entry Detail", "qty"))
|
||||
self.validate_no_missing_components(expected_rows, precision, tolerance)
|
||||
|
||||
for row in self.items:
|
||||
@@ -1127,7 +1128,9 @@ class StockEntry(StockController):
|
||||
title=_("Invalid Disassembly Item"),
|
||||
)
|
||||
|
||||
if abs(flt(row.transfer_qty, precision) - flt(expected, precision)) > tolerance:
|
||||
# qty is rounded in the row UOM, so allow that rounding scaled to stock UOM
|
||||
row_tolerance = max(tolerance, qty_tolerance * flt(row.conversion_factor))
|
||||
if abs(flt(row.transfer_qty, precision) - flt(expected, precision)) > row_tolerance:
|
||||
frappe.throw(
|
||||
_(
|
||||
"Row #{0}: Item {1} quantity ({2} in stock UOM) does not match the quantity "
|
||||
|
||||
Reference in New Issue
Block a user