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:
Poovetha
2026-10-23 12:16:49 +05:30
committed by pandiyan
parent a689f13ae2
commit 8238f6cf16
@@ -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 "