mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
fix: Job Card submitted qty
Update Operation Status function in work order was throwing exception without checking the "Overproduction Percentage For Work Order" setting. To submit Job Card qty for more than the Work Order's "To Manufacture Qty" we need to apply this fix.
This commit is contained in:
@@ -382,6 +382,9 @@ class WorkOrder(Document):
|
|||||||
return holidays[holiday_list]
|
return holidays[holiday_list]
|
||||||
|
|
||||||
def update_operation_status(self):
|
def update_operation_status(self):
|
||||||
|
allowance_percentage = flt(frappe.db.get_single_value("Manufacturing Settings", "overproduction_percentage_for_work_order"))
|
||||||
|
max_allowed_qty_for_wo = flt(self.qty) + (allowance_percentage/100 * flt(self.qty))
|
||||||
|
|
||||||
for d in self.get("operations"):
|
for d in self.get("operations"):
|
||||||
if not d.completed_qty:
|
if not d.completed_qty:
|
||||||
d.status = "Pending"
|
d.status = "Pending"
|
||||||
@@ -389,6 +392,8 @@ class WorkOrder(Document):
|
|||||||
d.status = "Work in Progress"
|
d.status = "Work in Progress"
|
||||||
elif flt(d.completed_qty) == flt(self.qty):
|
elif flt(d.completed_qty) == flt(self.qty):
|
||||||
d.status = "Completed"
|
d.status = "Completed"
|
||||||
|
elif flt(d.completed_qty) <= max_allowed_qty_for_wo:
|
||||||
|
d.status = "Completed"
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Completed Qty can not be greater than 'Qty to Manufacture'"))
|
frappe.throw(_("Completed Qty can not be greater than 'Qty to Manufacture'"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user