mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 21:49:18 +00:00
fix: max_qty validation condition
This commit is contained in:
@@ -635,12 +635,12 @@ class WorkOrder(Document):
|
|||||||
if self.production_plan and self.production_plan_item:
|
if self.production_plan and self.production_plan_item:
|
||||||
qty_dict = frappe.db.get_value("Production Plan Item", self.production_plan_item, ["planned_qty", "ordered_qty"], as_dict=1)
|
qty_dict = frappe.db.get_value("Production Plan Item", self.production_plan_item, ["planned_qty", "ordered_qty"], as_dict=1)
|
||||||
|
|
||||||
allowance_qty =flt(frappe.db.get_single_value("Manufacturing Settings",
|
allowance_qty = flt(frappe.db.get_single_value("Manufacturing Settings",
|
||||||
"overproduction_percentage_for_work_order"))/100 * qty_dict.get("planned_qty", 0)
|
"overproduction_percentage_for_work_order"))/100 * qty_dict.get("planned_qty", 0)
|
||||||
|
|
||||||
max_qty = qty_dict.get("planned_qty", 0) + allowance_qty - qty_dict.get("ordered_qty", 0)
|
max_qty = qty_dict.get("planned_qty", 0) + allowance_qty - qty_dict.get("ordered_qty", 0)
|
||||||
|
|
||||||
if max_qty < 1:
|
if not max_qty > 0:
|
||||||
frappe.throw(_("Cannot produce more item for {0}")
|
frappe.throw(_("Cannot produce more item for {0}")
|
||||||
.format(self.production_item), OverProductionError)
|
.format(self.production_item), OverProductionError)
|
||||||
elif self.qty > max_qty:
|
elif self.qty > max_qty:
|
||||||
|
|||||||
Reference in New Issue
Block a user