fix: don't make naming series mandatory for items

Item variants are an exception, hence this needs to be checked
conditionally.
This commit is contained in:
Ankush Menat 2021-11-15 17:11:33 +05:30 committed by Ankush Menat
parent 2eccb7a1ca
commit 7fcaeca403
2 changed files with 3 additions and 3 deletions

View File

@ -180,11 +180,11 @@ class NamingSeries(Document):
prefix = parse_naming_series(parts)
return prefix
def set_by_naming_series(doctype, fieldname, naming_series, hide_name_field=True):
def set_by_naming_series(doctype, fieldname, naming_series, hide_name_field=True, make_mandatory=1):
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
if naming_series:
make_property_setter(doctype, "naming_series", "hidden", 0, "Check", validate_fields_for_doctype=False)
make_property_setter(doctype, "naming_series", "reqd", 1, "Check", validate_fields_for_doctype=False)
make_property_setter(doctype, "naming_series", "reqd", make_mandatory, "Check", validate_fields_for_doctype=False)
# set values for mandatory
try:

View File

@ -20,7 +20,7 @@ class StockSettings(Document):
from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
set_by_naming_series("Item", "item_code",
self.get("item_naming_by")=="Naming Series", hide_name_field=True)
self.get("item_naming_by")=="Naming Series", hide_name_field=True, make_mandatory=0)
stock_frozen_limit = 356
submitted_stock_frozen = self.stock_frozen_upto_days or 0