mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 21:59:13 +00:00
Fix for Issue #4543: Automatic item_code generation for variants when parent item is named after a Naming Series
This commit is contained in:
@@ -33,6 +33,11 @@ class Item(WebsiteGenerator):
|
|||||||
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" and not self.variant_of:
|
||||||
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 frappe.db.get_default("item_naming_by")=="Naming Series" and self.variant_of:
|
||||||
|
item_code_suffix = ""
|
||||||
|
for attribute in self.attributes:
|
||||||
|
item_code_suffix += "-" + str(attribute.attribute_value)
|
||||||
|
self.item_code = str(self.variant_of) + item_code_suffix
|
||||||
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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user