Skip to content

Commit

Permalink
fix: include TDS regex in GSTIN regex
Browse files Browse the repository at this point in the history
(cherry picked from commit acd292f)
  • Loading branch information
ljain112 authored and mergify[bot] committed Mar 19, 2024
1 parent cecdd2d commit b7bac89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions india_compliance/gst_india/client_scripts/party.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ function validate_gstin(doctype) {
frappe.throw(__("GSTIN/UIN should be 15 characters long"));
}

gstin = india_compliance.validate_gstin(gstin);

if (TCS_REGEX.test(gstin)) {
frappe.throw(__("e-Commerce Operator (TCS) GSTIN is not allowed to be set in Party/Address"));
frappe.throw(
__(
"e-Commerce Operator (TCS) GSTIN is not allowed to be set in Party/Address"
)
);
}

gstin = india_compliance.validate_gstin(gstin);

frm.doc.gstin = gstin;
frm.refresh_field("gstin");

Expand Down
3 changes: 1 addition & 2 deletions india_compliance/public/js/regex_constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ export const OVERSEAS_REGEX = new RegExp([NRI_ID, OIDAR].join("|"));
export const UNBODY_REGEX = new RegExp(UNBODY);
export const TDS_REGEX = new RegExp(TDS);

// TDS is covered in Normal, hence not included separately
export const GSTIN_REGEX = new RegExp(
[NORMAL, GOVT_DEPTID, NRI_ID, OIDAR, UNBODY].join("|")
[NORMAL, GOVT_DEPTID, NRI_ID, OIDAR, UNBODY, TDS].join("|")
);

export const GST_INVOICE_NUMBER_FORMAT = new RegExp("^[^\\W_][A-Za-z\\d\\-/]{0,15}$");

0 comments on commit b7bac89

Please sign in to comment.