function moved to validate

This commit is contained in:
Neil Trini Lasrado 2015-02-06 16:15:45 +05:30
parent 8fd3828ef5
commit 845be908d6

View File

@ -57,6 +57,7 @@ class Item(WebsiteGenerator):
self.validate_reorder_level()
self.validate_warehouse_for_reorder()
self.validate_variants()
self.update_item_desc()
if not self.get("__islocal"):
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
@ -69,7 +70,6 @@ class Item(WebsiteGenerator):
self.validate_name_with_item_group()
self.update_item_price()
self.sync_variants()
self.update_item_desc()
def get_context(self, context):
context["parent_groups"] = get_parent_item_groups(self.item_group) + \
@ -436,9 +436,10 @@ class Item(WebsiteGenerator):
row.description = desc
def update_item_desc(self):
frappe.db.sql("""update `tabBOM` set description = %s where item = %s and docstatus < 2""",(self.description, self.name))
frappe.db.sql("""update `tabBOM Item` set description = %s where item_code = %s and docstatus < 2""",(self.description, self.name))
frappe.db.sql("""update `tabBOM Explosion Item` set description = %s where item_code = %s and docstatus < 2""",(self.description, self.name))
if frappe.db.get_value('BOM',self.name, 'description') != self.description:
frappe.db.sql("""update `tabBOM` set description = %s where item = %s and docstatus < 2""",(self.description, self.name))
frappe.db.sql("""update `tabBOM Item` set description = %s where item_code = %s and docstatus < 2""",(self.description, self.name))
frappe.db.sql("""update `tabBOM Explosion Item` set description = %s where item_code = %s and docstatus < 2""",(self.description, self.name))
def validate_end_of_life(item_code, end_of_life=None, verbose=1):
if not end_of_life: