From 7fb385a89f12f4ed22d01282020793686c415ce2 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Wed, 19 May 2021 18:47:06 +0530 Subject: [PATCH 1/2] fix: cannot bypass e-invoicing for non gst item invoices --- erpnext/regional/india/e_invoice/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/regional/india/e_invoice/utils.py b/erpnext/regional/india/e_invoice/utils.py index b4e7a8889e..0315c83fd1 100644 --- a/erpnext/regional/india/e_invoice/utils.py +++ b/erpnext/regional/india/e_invoice/utils.py @@ -43,8 +43,9 @@ def validate_eligibility(doc): 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 = not doc.get('taxes') + has_non_gst_item = any(d for d in doc.get('items') if frappe.db.get_value('Item', d.get('item_code'), 'is_non_gst')) - if invalid_company or invalid_supply_type or company_transaction or no_taxes_applied: + if invalid_company or invalid_supply_type or company_transaction or no_taxes_applied or has_non_gst_item: return False return True From b9ad385232d5e6a66fa418bdb879b3eb85c263b3 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Wed, 19 May 2021 19:13:06 +0530 Subject: [PATCH 2/2] fix: remove uncessary query --- erpnext/regional/india/e_invoice/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/regional/india/e_invoice/utils.py b/erpnext/regional/india/e_invoice/utils.py index 0315c83fd1..70e6d07eab 100644 --- a/erpnext/regional/india/e_invoice/utils.py +++ b/erpnext/regional/india/e_invoice/utils.py @@ -43,7 +43,7 @@ def validate_eligibility(doc): 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 = not doc.get('taxes') - has_non_gst_item = any(d for d in doc.get('items') if frappe.db.get_value('Item', d.get('item_code'), 'is_non_gst')) + has_non_gst_item = any(d for d in doc.get('items') if d.get('is_non_gst')) if invalid_company or invalid_supply_type or company_transaction or no_taxes_applied or has_non_gst_item: return False