mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 23:19:20 +00:00
fix: returning condition
This commit is contained in:
@@ -18,12 +18,12 @@ from erpnext.regional.india.utils import get_gst_accounts, get_place_of_supply
|
|||||||
from frappe.utils.data import cstr, cint, formatdate as format_date, flt, time_diff_in_seconds, now_datetime, add_to_date
|
from frappe.utils.data import cstr, cint, formatdate as format_date, flt, time_diff_in_seconds, now_datetime, add_to_date
|
||||||
|
|
||||||
def validate_einvoice_fields(doc):
|
def validate_einvoice_fields(doc):
|
||||||
einvoicing_enabled = frappe.db.get_value('E Invoice Settings', 'E Invoice Settings', 'enable')
|
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 not in ['Sales Invoice']
|
||||||
invalid_supply_type = doc.get('gst_category') not in ['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export']
|
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')
|
company_transaction = doc.get('billing_address_gstin') == doc.get('company_gstin')
|
||||||
|
|
||||||
if invalid_doctype or invalid_supply_type or company_transaction or not einvoicing_enabled: return
|
if not einvoicing_enabled or invalid_doctype or invalid_supply_type or company_transaction: return
|
||||||
|
|
||||||
if doc.docstatus == 0 and doc._action == 'save':
|
if doc.docstatus == 0 and doc._action == 'save':
|
||||||
if doc.irn:
|
if doc.irn:
|
||||||
|
|||||||
Reference in New Issue
Block a user