Merge branch 'gabtzi-develop' into develop
This commit is contained in:
commit
9602c394dd
@ -30,7 +30,16 @@ class Item(WebsiteGenerator):
|
|||||||
self.get("__onload").sle_exists = self.check_if_sle_exists()
|
self.get("__onload").sle_exists = self.check_if_sle_exists()
|
||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
if frappe.db.get_default("item_naming_by")=="Naming Series" and not self.variant_of:
|
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")
|
||||||
|
item_code_suffix += "-" + str(attribute_abbr or attribute.attribute_value)
|
||||||
|
self.item_code = str(self.variant_of) + item_code_suffix
|
||||||
|
else:
|
||||||
from frappe.model.naming import make_autoname
|
from frappe.model.naming import make_autoname
|
||||||
self.item_code = make_autoname(self.naming_series+'.#####')
|
self.item_code = make_autoname(self.naming_series+'.#####')
|
||||||
elif not self.item_code:
|
elif not self.item_code:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user