fix: not able to make stock entry against MR (#42874)

This commit is contained in:
rohitwaghchaure
2024-08-22 19:33:14 +05:30
committed by GitHub
parent 2ca0f416a9
commit 63ca1025bc

View File

@@ -267,6 +267,7 @@ 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))
@@ -276,14 +277,14 @@ class MaterialRequest(BuyingController):
(d.qty + (d.qty * (mr_qty_allowance / 100))), d.precision("ordered_qty")
)
if d.ordered_qty and d.ordered_qty > allowed_qty:
if d.ordered_qty and flt(d.ordered_qty, precision) > flt(allowed_qty, precision):
frappe.throw(
_(
"The total Issue / Transfer quantity {0} in Material Request {1} cannot be greater than allowed requested quantity {2} for Item {3}"
).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}"