Over Production Allowance Percentage Setting added to Manufacturing Settings

This commit is contained in:
Neil Trini Lasrado 2015-06-15 15:58:45 +05:30
parent 77f04e293a
commit 4abf552d7b
2 changed files with 11 additions and 3 deletions

View File

@ -55,6 +55,13 @@
"label": "Time Between Operations (in mins)",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "over_production_allowance_percentage",
"fieldtype": "Percent",
"label": "Over Production Allowance Percentage",
"permlevel": 0,
"precision": ""
}
],
"hide_heading": 0,
@ -65,7 +72,7 @@
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-04-21 07:57:40.260862",
"modified": "2015-06-15 05:52:22.986958",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing Settings",

View File

@ -90,8 +90,9 @@ class ProductionOrder(Document):
(self.sales_order, self.production_item))[0][0]
# total qty in SO
so_qty = flt(so_item_qty) + flt(dnpi_qty)
if total_qty > so_qty:
allowance_percentage = flt(frappe.db.get_single_value("Manufacturing Settings", "over_production_allowance_percentage"))
if total_qty > so_qty + (allowance_percentage/100 * so_qty):
frappe.throw(_("Cannot produce more Item {0} than Sales Order quantity {1}").format(self.production_item,
so_qty), OverProductionError)