diff --git a/erpnext/patches/v12_0/add_company_link_to_einvoice_settings.py b/erpnext/patches/v12_0/add_company_link_to_einvoice_settings.py index c2ed6c288fe..712eb4f61c2 100644 --- a/erpnext/patches/v12_0/add_company_link_to_einvoice_settings.py +++ b/erpnext/patches/v12_0/add_company_link_to_einvoice_settings.py @@ -3,10 +3,14 @@ import frappe def execute(): company = frappe.get_all('Company', filters = {'country': 'India'}) - if not company or not frappe.db.count('E Invoice User'): + + if not company: return frappe.reload_doc("regional", "doctype", "e_invoice_user") + if not frappe.db.count('E Invoice User'): + return + for creds in frappe.db.get_all('E Invoice User', fields=['name', 'gstin']): company_name = frappe.db.sql(""" select dl.link_name from `tabAddress` a, `tabDynamic Link` dl