From c5b061834b89a2899bc491df0188bb5e8c80ea77 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Tue, 20 Mar 2018 13:06:18 +0530 Subject: [PATCH] doctype dropdown rectify, validate series is set (#13305) --- erpnext/setup/doctype/naming_series/naming_series.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index 45345846bc..c90a75f395 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -20,7 +20,7 @@ class NamingSeries(Document): + frappe.db.sql_list("""select dt from `tabCustom Field` where fieldname='naming_series'"""))) - doctypes = list(set(get_doctypes_with_read()) | set(doctypes)) + doctypes = list(set(get_doctypes_with_read()).intersection(set(doctypes))) prefixes = "" for d in doctypes: options = "" @@ -47,6 +47,7 @@ class NamingSeries(Document): def update_series(self, arg=None): """update series list""" + self.validate_series_set() self.check_duplicate() series_list = self.set_options.split("\n") @@ -60,6 +61,10 @@ class NamingSeries(Document): return self.get_transactions() + def validate_series_set(self): + if self.select_doc_for_series and not self.set_options: + frappe.throw(_("Please set the series to be used.")) + def set_series_for(self, doctype, ol): options = self.scrub_options_list(ol)