fix(e-invoice): skip e-invoice generation for non-taxable invoices (#24568) (#24569)

This commit is contained in:
Saqib
2021-02-08 11:43:29 +05:30
committed by GitHub
parent 078e154966
commit e42e75178a

View File

@@ -20,11 +20,13 @@ from frappe.utils.data import cstr, cint, formatdate as format_date, flt, time_d
def validate_einvoice_fields(doc):
einvoicing_enabled = cint(frappe.db.get_value('E Invoice Settings', 'E Invoice Settings', 'enable'))
invalid_doctype = doc.doctype not in ['Sales Invoice']
invalid_doctype = doc.doctype != 'Sales Invoice'
invalid_supply_type = doc.get('gst_category') not in ['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export']
company_transaction = doc.get('billing_address_gstin') == doc.get('company_gstin')
no_taxes_applied = len(doc.get('taxes')) == 0
if not einvoicing_enabled or invalid_doctype or invalid_supply_type or company_transaction: return
if not einvoicing_enabled or invalid_doctype or invalid_supply_type or company_transaction or no_taxes_applied:
return
if doc.docstatus == 0 and doc._action == 'save':
if doc.irn: