Merge pull request #4868 from nabinhait/bom_fix

[fix] validate BOMs in BOM Replace Tool
This commit is contained in:
Nabin Hait 2016-02-25 10:41:38 +05:30
commit 1a9c1c4243

View File

@ -24,6 +24,10 @@ class BOMReplaceTool(Document):
if cstr(self.current_bom) == cstr(self.new_bom):
frappe.throw(_("Current BOM and New BOM can not be same"))
if frappe.db.get_value("BOM", self.current_bom, "item") \
!= frappe.db.get_value("BOM", self.new_bom, "item"):
frappe.throw(_("The selected BOMs are not for the same item"))
def update_new_bom(self):
current_bom_unitcost = frappe.db.sql("""select total_cost/quantity
from `tabBOM` where name = %s""", self.current_bom)