This commit is contained in:
parent
e10cf021d9
commit
7fb79f6062
@ -12,15 +12,27 @@ from frappe.model.document import Document
|
|||||||
class NamingSeries(Document):
|
class NamingSeries(Document):
|
||||||
|
|
||||||
def get_transactions(self, arg=None):
|
def get_transactions(self, arg=None):
|
||||||
return {
|
doctypes = list(set(frappe.db.sql_list("""select parent
|
||||||
"transactions": "\n".join([''] + sorted(list(set(
|
|
||||||
frappe.db.sql_list("""select parent
|
|
||||||
from `tabDocField` where fieldname='naming_series'""")
|
from `tabDocField` where fieldname='naming_series'""")
|
||||||
+ frappe.db.sql_list("""select dt from `tabCustom Field`
|
+ frappe.db.sql_list("""select dt from `tabCustom Field`
|
||||||
where fieldname='naming_series'""")
|
where fieldname='naming_series'""")))
|
||||||
)))),
|
|
||||||
"prefixes": "\n".join([''] + [i[0] for i in
|
prefixes = ""
|
||||||
frappe.db.sql("""select name from tabSeries order by name""")])
|
for d in doctypes:
|
||||||
|
print d
|
||||||
|
try:
|
||||||
|
options = self.get_options(d)
|
||||||
|
except frappe.DoesNotExistError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
prefixes = prefixes + "\n" + options
|
||||||
|
|
||||||
|
prefixes.replace("\n\n", "\n")
|
||||||
|
prefixes = "\n".join(sorted(prefixes.split()))
|
||||||
|
|
||||||
|
return {
|
||||||
|
"transactions": "\n".join([''] + sorted(doctypes)),
|
||||||
|
"prefixes": prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
def scrub_options_list(self, ol):
|
def scrub_options_list(self, ol):
|
||||||
@ -110,8 +122,8 @@ class NamingSeries(Document):
|
|||||||
if not re.match("^[a-zA-Z0-9- /.#]*$", n):
|
if not re.match("^[a-zA-Z0-9- /.#]*$", n):
|
||||||
throw(_('Special Characters except "-" and "/" not allowed in naming series'))
|
throw(_('Special Characters except "-" and "/" not allowed in naming series'))
|
||||||
|
|
||||||
def get_options(self, arg=''):
|
def get_options(self, arg=None):
|
||||||
return frappe.get_meta(self.select_doc_for_series).get_field("naming_series").options
|
return frappe.get_meta(arg or self.select_doc_for_series).get_field("naming_series").options
|
||||||
|
|
||||||
def get_current(self, arg=None):
|
def get_current(self, arg=None):
|
||||||
"""get series current"""
|
"""get series current"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user