fix: validated GST state

fix: validated GST state
This commit is contained in:
Anurag Mishra 2021-01-13 15:27:29 +05:30 committed by GitHub
commit 5ef50d3914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,9 @@ def validate_gstin_for_india(doc, method):
validate_gstin_check_digit(doc.gstin) validate_gstin_check_digit(doc.gstin)
set_gst_state_and_state_number(doc) set_gst_state_and_state_number(doc)
if not doc.gst_state:
frappe.throw(_("Please Enter GST state"))
if doc.gst_state_number != doc.gstin[:2]: if doc.gst_state_number != doc.gstin[:2]:
frappe.throw(_("Invalid GSTIN! First 2 digits of GSTIN should match with State number {0}.") frappe.throw(_("Invalid GSTIN! First 2 digits of GSTIN should match with State number {0}.")
.format(doc.gst_state_number)) .format(doc.gst_state_number))