def get_transactions(self, arg=None): doctypes = list(set(frappe.db.sql_list("""select parent from `tabDocField` df where fieldname='naming_series'""") + frappe.db.sql_list("""select dt from `tabCustom Field` where fieldname='naming_series'"""))) doctypes = list(set(get_doctypes_with_read()) | set(doctypes)) prefixes = "" for d in doctypes: options = "" try: options = self.get_options(d) except frappe.DoesNotExistError: frappe.msgprint('Unable to find DocType {0}'.format(d)) #frappe.pass_does_not_exist_error() continue if options: prefixes = prefixes + "\n" + options prefixes.replace("\n\n", "\n") prefixes = "\n".join(sorted(prefixes.split())) return { "transactions": "\n".join([''] + sorted(doctypes)), "prefixes": prefixes }
def get_transactions(self, arg=None): doctypes = list( set( frappe.db.sql_list("""select parent from `tabDocField` df where fieldname='naming_series'""") + frappe.db.sql_list("""select dt from `tabCustom Field` where fieldname='naming_series'"""))) doctypes = list(set(get_doctypes_with_read()) | set(doctypes)) prefixes = "" for d in doctypes: options = "" try: options = self.get_options(d) except frappe.DoesNotExistError: frappe.msgprint('Unable to find DocType {0}'.format(d)) #frappe.pass_does_not_exist_error() continue if options: prefixes = prefixes + "\n" + options prefixes.replace("\n\n", "\n") prefixes = "\n".join(sorted(prefixes.split())) return { "transactions": "\n".join([''] + sorted(doctypes)), "prefixes": prefixes }
def get_transactions(self, arg=None): doctypes = list(set(frappe.db.sql_list("""select parent from `tabDocField` df where fieldname='naming_series'""") + frappe.db.sql_list("""select dt from `tabCustom Field` where fieldname='naming_series'"""))) doctypes = list(set(get_doctypes_with_read()).intersection(set(doctypes))) prefixes = "" for d in doctypes: options = "" try: options = self.get_options(d) except frappe.DoesNotExistError: frappe.msgprint(_('Unable to find DocType {0}').format(d)) #frappe.pass_does_not_exist_error() continue if options: prefixes = prefixes + "\n" + options prefixes.replace("\n\n", "\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)), "prefixes": prefixes }
def get_transactions(self, arg=None): doctypes = list( set( frappe.db.sql_list("""select parent from `tabDocField` df where fieldname='naming_series'""") + frappe.db.sql_list("""select dt from `tabCustom Field` where fieldname='naming_series'"""))) doctypes = list( set(get_doctypes_with_read()).intersection(set(doctypes))) return {"transactions": doctypes}