fix(UX): dont query options for doctype that dont exist

This commit is contained in:
Ankush Menat 2022-05-30 17:50:57 +05:30
parent 22f2c78400
commit b0a7c47de7
2 changed files with 8 additions and 4 deletions

View file

@ -167,9 +167,13 @@ class DocumentNamingSettings(Document):
)
@frappe.whitelist()
def get_options(self, arg=None):
if frappe.get_meta(arg or self.transaction_type).get_field("naming_series"):
return frappe.get_meta(arg or self.transaction_type).get_field("naming_series").options
def get_options(self, doctype=None):
doctype = doctype or self.transaction_type
if not doctype:
return
if frappe.get_meta(doctype or self.transaction_type).get_field("naming_series"):
return frappe.get_meta(doctype or self.transaction_type).get_field("naming_series").options
@frappe.whitelist()
def get_current(self, arg=None):

View file

@ -10,7 +10,7 @@ from frappe.tests.utils import FrappeTestCase
class TestNamingSeries(FrappeTestCase):
def setUp(self):
self.ns: DocumentNamingSettings = frappe.get_doc("Naming Series Settings")
self.ns: DocumentNamingSettings = frappe.get_doc("Document Naming Settings")
def tearDown(self):
frappe.db.rollback()