From bb0290e61fdba63e1ff9441bd236b598d218bb3f Mon Sep 17 00:00:00 2001 From: kunhimohamed Date: Tue, 21 Apr 2026 18:38:02 +0400 Subject: [PATCH 1/3] fix(tax_validation): tax id validation based on vat registraton such as turnover --- .../doctype/accounts_settings/accounts_settings.json | 4 ++-- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 1b7c21ab721d..157cf54f72ae 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -299,7 +299,7 @@ "fieldname": "validate_sales_invoice_tax_id", "fieldtype": "Select", "label": "Validate Customer Tax ID for Sales Tax Invoice", - "options": "\nMandatory\nMandatory for Company" + "options": "\nMandatory\nMandatory for Company\nMandatory for Company and Annual Turnover" }, { "default": "0", @@ -325,7 +325,7 @@ "idx": 1, "issingle": 1, "links": [], - "modified": "2025-08-28 14:27:21.809120", + "modified": "2026-04-21 18:35:17.448972", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index bb1d24ac9e44..0cc5f9063353 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -656,6 +656,11 @@ def validate_tax_id_mandatory(self): if validation == "Mandatory for Company": if frappe.get_cached_value("Customer", self.bill_to or self.customer, "customer_type") == "Individual": return + if validation == "Mandatory for Company and Annual Turnover": + if frappe.get_cached_value("Customer", self.bill_to or self.customer, "customer_type") == "Individual" or \ + (frappe.get_cached_value("Customer", self.bill_to or self.customer, "customer_type") == "Company" and \ + frappe.get_cached_value("Customer", self.bill_to or self.customer, "vat_registration_decider") == "Annual Turnover <= 375,000 AED"): + return if validation: frappe.throw(_("Customer {0} or Identification Number is mandatory for Sales Tax Invoice").format(_("Tax ID"))) From 916ea243306b153bc99bd7f69a9454ae3c6e929c Mon Sep 17 00:00:00 2001 From: kunhimohamed Date: Fri, 8 May 2026 15:07:52 +0400 Subject: [PATCH 2/3] fix(Sales Invoice): vat validation override based on customer tax_id_non_mandatory field --- erpnext/selling/doctype/customer/customer.json | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 060dcd08a842..f485b4dbcc91 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -29,6 +29,7 @@ "tax_id", "tax_strn", "tax_status", + "tax_id_non_mandatory", "primary_contact_person_section", "salutation", "column_break_53", @@ -325,7 +326,8 @@ "in_preview": 1, "in_standard_filter": 1, "label": "Mobile No (Primary)", - "options": "Phone" + "options": "Phone", + "search_index": 1 }, { "bold": 1, @@ -333,7 +335,8 @@ "fieldtype": "Data", "in_preview": 1, "in_standard_filter": 1, - "label": "Email Address" + "label": "Email Address", + "search_index": 1 }, { "fieldname": "customer_primary_address", @@ -724,13 +727,22 @@ "fieldtype": "Table", "label": "Goodwill Accounts", "options": "Party Account" + }, + { + "default": "0", + "fieldname": "tax_id_non_mandatory", + "fieldtype": "Check", + "hidden": 1, + "label": "Tax ID Non Mandatory", + "no_copy": 1, + "print_hide": 1 } ], "icon": "fa fa-user", "idx": 363, "image_field": "image", "links": [], - "modified": "2026-04-01 15:45:59.681846", + "modified": "2026-05-08 14:53:41.715259", "modified_by": "Administrator", "module": "Selling", "name": "Customer", From 52c969e4894dc519bc17029a86aab6c6b580a6cb Mon Sep 17 00:00:00 2001 From: kunhimohamed Date: Fri, 8 May 2026 15:24:15 +0400 Subject: [PATCH 3/3] fix(accounts settings): no need changes in accounts settings --- .../accounts/doctype/accounts_settings/accounts_settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 157cf54f72ae..1b7c21ab721d 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -299,7 +299,7 @@ "fieldname": "validate_sales_invoice_tax_id", "fieldtype": "Select", "label": "Validate Customer Tax ID for Sales Tax Invoice", - "options": "\nMandatory\nMandatory for Company\nMandatory for Company and Annual Turnover" + "options": "\nMandatory\nMandatory for Company" }, { "default": "0", @@ -325,7 +325,7 @@ "idx": 1, "issingle": 1, "links": [], - "modified": "2026-04-21 18:35:17.448972", + "modified": "2025-08-28 14:27:21.809120", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings",