Merge pull request #4868 from nabinhait/bom_fix
[fix] validate BOMs in BOM Replace Tool
This commit is contained in:
commit
1a9c1c4243
@ -24,6 +24,10 @@ class BOMReplaceTool(Document):
|
|||||||
if cstr(self.current_bom) == cstr(self.new_bom):
|
if cstr(self.current_bom) == cstr(self.new_bom):
|
||||||
frappe.throw(_("Current BOM and New BOM can not be same"))
|
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):
|
def update_new_bom(self):
|
||||||
current_bom_unitcost = frappe.db.sql("""select total_cost/quantity
|
current_bom_unitcost = frappe.db.sql("""select total_cost/quantity
|
||||||
from `tabBOM` where name = %s""", self.current_bom)
|
from `tabBOM` where name = %s""", self.current_bom)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user