feat: Basic validation for indian PAN No. in Supplier (#24687)

This commit is contained in:
Deepesh Garg
2021-02-22 19:28:45 +05:30
committed by GitHub
parent 8676bedd18
commit bb8cd1cdaa
2 changed files with 11 additions and 0 deletions

View File

@@ -55,6 +55,14 @@ def validate_gstin_for_india(doc, method):
frappe.throw(_("Invalid GSTIN! First 2 digits of GSTIN should match with State number {0}.")
.format(doc.gst_state_number))
def validate_pan_for_india(doc, method):
if doc.get('country') != 'India':
return
p = re.compile("[A-Z]{5}[0-9]{4}[A-Z]{1}")
if not p.match(doc.pan):
frappe.throw(_("Invalid PAN No. The input you've entered doesn't match the format of PAN."))
def validate_tax_category(doc, method):
if doc.get('gst_state') and frappe.db.get_value('Tax Category', {'gst_state': doc.gst_state, 'is_inter_state': doc.is_inter_state}):
if doc.is_inter_state: