Fix for Issue #4543: Improved code to check if it's a variant only once.
This commit is contained in:
parent
9d44ac88f2
commit
096fc88200
@ -30,14 +30,15 @@ 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":
|
||||||
from frappe.model.naming import make_autoname
|
if self.variant_of:
|
||||||
self.item_code = make_autoname(self.naming_series+'.#####')
|
item_code_suffix = ""
|
||||||
elif frappe.db.get_default("item_naming_by")=="Naming Series" and self.variant_of:
|
for attribute in self.attributes:
|
||||||
item_code_suffix = ""
|
item_code_suffix += "-" + str(attribute.attribute_value)
|
||||||
for attribute in self.attributes:
|
self.item_code = str(self.variant_of) + item_code_suffix
|
||||||
item_code_suffix += "-" + str(attribute.attribute_value)
|
else:
|
||||||
self.item_code = str(self.variant_of) + item_code_suffix
|
from frappe.model.naming import make_autoname
|
||||||
|
self.item_code = make_autoname(self.naming_series+'.#####')
|
||||||
elif not self.item_code:
|
elif not self.item_code:
|
||||||
msgprint(_("Item Code is mandatory because Item is not automatically numbered"), raise_exception=1)
|
msgprint(_("Item Code is mandatory because Item is not automatically numbered"), raise_exception=1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user