[fix] Minor changes in item naming

This commit is contained in:
Nabin Hait 2015-12-31 15:48:48 +05:30
parent dd1c3ba164
commit 51ff2658cb

View File

@ -32,9 +32,11 @@ class Item(WebsiteGenerator):
def autoname(self):
if frappe.db.get_default("item_naming_by")=="Naming Series":
if self.variant_of:
if not self.item_code:
item_code_suffix = ""
for attribute in self.attributes:
attribute_abbr = frappe.db.get_value("Item Attribute Value", {"parent": attribute.attribute, "attribute_value": attribute.attribute_value}, "abbr")
attribute_abbr = frappe.db.get_value("Item Attribute Value",
{"parent": attribute.attribute, "attribute_value": attribute.attribute_value}, "abbr")
item_code_suffix += "-" + str(attribute_abbr or attribute.attribute_value)
self.item_code = str(self.variant_of) + item_code_suffix
else: