fix: using db.exists and get_value instead of get_doc

This commit is contained in:
Subin Tom 2021-09-29 11:11:55 +05:30
parent 0a28fed679
commit 8675ca5bdd

View File

@ -25,9 +25,9 @@ class TaxJarSettings(Document):
custom_fields = []
for dt in ['Item', 'Sales Invoice Item']:
doc = frappe.get_doc('Custom Field', {'dt': dt, 'fieldname':'product_tax_category'})
doc = frappe.db.exists('Custom Field', {'dt': dt, 'fieldname':'product_tax_category'})
custom_fields.append(doc)
fields_hidden = doc.get('hidden') if doc else 0
fields_hidden = frappe.db.get_value('Custom Field', {'dt': dt, 'fieldname':'product_tax_category'},'hidden')
fields_already_exist = True if custom_fields else False