From 35cd1d325f2e07f716a280cc84a03755e5a766bc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 28 Nov 2017 13:01:01 +0530 Subject: [PATCH] [fix] Set GST State code based on state, even if GSTIN not mentioned (#11755) --- erpnext/regional/india/utils.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 8f2dacda707..2cd71a5bec0 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -14,15 +14,15 @@ def validate_gstin_for_india(doc, method): if not p.match(doc.gstin): frappe.throw(_("Invalid GSTIN or Enter NA for Unregistered")) - if not doc.gst_state: - if doc.state in states: - doc.gst_state = doc.state + if not doc.gst_state: + if doc.state in states: + doc.gst_state = doc.state - if doc.gst_state: - doc.gst_state_number = state_numbers[doc.gst_state] - if doc.gstin != "NA" and doc.gst_state_number != doc.gstin[:2]: - frappe.throw(_("First 2 digits of GSTIN should match with State number {0}") - .format(doc.gst_state_number)) + if doc.gst_state: + doc.gst_state_number = state_numbers[doc.gst_state] + if doc.gstin and doc.gstin != "NA" and doc.gst_state_number != doc.gstin[:2]: + frappe.throw(_("First 2 digits of GSTIN should match with State number {0}") + .format(doc.gst_state_number)) def get_itemised_tax_breakup_header(item_doctype, tax_accounts): if frappe.get_meta(item_doctype).has_field('gst_hsn_code'):