At least add a row for old logic to work properly

This commit is contained in:
Saif Ur Rehman 2018-09-26 23:23:56 +05:00
parent c819ea38a0
commit 127b3f552b

View File

@ -128,6 +128,7 @@ class Item(WebsiteGenerator):
self.validate_uom_conversion_factor()
self.validate_item_defaults()
self.update_defaults_from_item_group()
self.update_defaults_add_company()
if not self.get("__islocal"):
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
@ -135,6 +136,10 @@ class Item(WebsiteGenerator):
from `tabWebsite Item Group`
where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
def update_defaults_add_company(self):
if not self.item_defaults:
self.append("item_defaults", {"company": frappe.defaults.get_defaults().company})
def on_update(self):
invalidate_cache_for_item(self)
self.validate_name_with_item_group()