fix: precision issue while submitting the stock entry (#36575)
fix: precision issue while submmiting the stock entry
(cherry picked from commit a864e07d4f)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -223,12 +223,13 @@ class MaterialRequest(BuyingController):
|
||||
mr_qty_allowance = frappe.db.get_single_value("Stock Settings", "mr_qty_allowance")
|
||||
|
||||
for d in self.get("items"):
|
||||
precision = d.precision("ordered_qty")
|
||||
if d.name in mr_items:
|
||||
if self.material_request_type in ("Material Issue", "Material Transfer", "Customer Provided"):
|
||||
d.ordered_qty = flt(mr_items_ordered_qty.get(d.name))
|
||||
|
||||
if mr_qty_allowance:
|
||||
allowed_qty = flt((d.qty + (d.qty * (mr_qty_allowance / 100))), d.precision("ordered_qty"))
|
||||
allowed_qty = flt((d.qty + (d.qty * (mr_qty_allowance / 100))), precision)
|
||||
|
||||
if d.ordered_qty and d.ordered_qty > allowed_qty:
|
||||
frappe.throw(
|
||||
@@ -237,11 +238,11 @@ class MaterialRequest(BuyingController):
|
||||
).format(d.ordered_qty, d.parent, allowed_qty, d.item_code)
|
||||
)
|
||||
|
||||
elif d.ordered_qty and d.ordered_qty > d.stock_qty:
|
||||
elif d.ordered_qty and flt(d.ordered_qty, precision) > flt(d.stock_qty, precision):
|
||||
frappe.throw(
|
||||
_(
|
||||
"The total Issue / Transfer quantity {0} in Material Request {1} cannot be greater than requested quantity {2} for Item {3}"
|
||||
).format(d.ordered_qty, d.parent, d.qty, d.item_code)
|
||||
).format(d.ordered_qty, d.parent, d.stock_qty, d.item_code)
|
||||
)
|
||||
|
||||
elif self.material_request_type == "Manufacture":
|
||||
|
||||
Reference in New Issue
Block a user