[Fix] Not able to update the current value of the prefixes which are defined in the autoname field (#14918)

This commit is contained in:
rohitwaghchaure 2018-07-17 12:45:25 +05:30 committed by Nabin Hait
parent fbeab5bf73
commit 5fe88ea93e

View File

@ -34,7 +34,14 @@ class NamingSeries(Document):
if options:
prefixes = prefixes + "\n" + options
prefixes.replace("\n\n", "\n")
prefixes = "\n".join(sorted(prefixes.split("\n")))
prefixes = prefixes.split("\n")
custom_prefixes = frappe.get_all('DocType', fields=["autoname"],
filters={"name": ('not in', doctypes), "autoname":('like', '%.#%'), 'module': ('not in', ['Core'])})
if custom_prefixes:
prefixes = prefixes + [d.autoname.rsplit('.', 1)[0] for d in custom_prefixes]
prefixes = "\n".join(sorted(prefixes))
return {
"transactions": "\n".join([''] + sorted(doctypes)),