[fix] Minor changes in item naming
This commit is contained in:
parent
dd1c3ba164
commit
51ff2658cb
@ -32,9 +32,11 @@ class Item(WebsiteGenerator):
|
|||||||
def autoname(self):
|
def autoname(self):
|
||||||
if frappe.db.get_default("item_naming_by")=="Naming Series":
|
if frappe.db.get_default("item_naming_by")=="Naming Series":
|
||||||
if self.variant_of:
|
if self.variant_of:
|
||||||
|
if not self.item_code:
|
||||||
item_code_suffix = ""
|
item_code_suffix = ""
|
||||||
for attribute in self.attributes:
|
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)
|
item_code_suffix += "-" + str(attribute_abbr or attribute.attribute_value)
|
||||||
self.item_code = str(self.variant_of) + item_code_suffix
|
self.item_code = str(self.variant_of) + item_code_suffix
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user