fix: Validation for duplicate Tax Category
This commit is contained in:
@@ -239,6 +239,9 @@ doc_events = {
|
|||||||
"Website Settings": {
|
"Website Settings": {
|
||||||
"validate": "erpnext.portal.doctype.products_settings.products_settings.home_page_is_products"
|
"validate": "erpnext.portal.doctype.products_settings.products_settings.home_page_is_products"
|
||||||
},
|
},
|
||||||
|
"Tax Category": {
|
||||||
|
"validate": "erpnext.regional.india.utils.validate_tax_category"
|
||||||
|
},
|
||||||
"Sales Invoice": {
|
"Sales Invoice": {
|
||||||
"on_submit": ["erpnext.regional.create_transaction_log", "erpnext.regional.italy.utils.sales_invoice_on_submit"],
|
"on_submit": ["erpnext.regional.create_transaction_log", "erpnext.regional.italy.utils.sales_invoice_on_submit"],
|
||||||
"on_cancel": "erpnext.regional.italy.utils.sales_invoice_on_cancel",
|
"on_cancel": "erpnext.regional.italy.utils.sales_invoice_on_cancel",
|
||||||
|
|||||||
@@ -52,6 +52,13 @@ def validate_gstin_for_india(doc, method):
|
|||||||
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))
|
||||||
|
|
||||||
|
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:
|
||||||
|
frappe.throw(_("Inter State tax category for GST State {0} already exists").format(doc.gst_state))
|
||||||
|
else:
|
||||||
|
frappe.throw(_("Intra State tax category for GST State {0} already exists").format(doc.gst_state))
|
||||||
|
|
||||||
def update_gst_category(doc, method):
|
def update_gst_category(doc, method):
|
||||||
for link in doc.links:
|
for link in doc.links:
|
||||||
if link.link_doctype in ['Customer', 'Supplier']:
|
if link.link_doctype in ['Customer', 'Supplier']:
|
||||||
@@ -523,7 +530,7 @@ def get_address_details(data, doc, company_address, billing_address):
|
|||||||
data.transType = 1
|
data.transType = 1
|
||||||
data.actualToStateCode = data.toStateCode
|
data.actualToStateCode = data.toStateCode
|
||||||
shipping_address = billing_address
|
shipping_address = billing_address
|
||||||
|
|
||||||
if doc.gst_category == 'SEZ':
|
if doc.gst_category == 'SEZ':
|
||||||
data.toStateCode = 99
|
data.toStateCode = 99
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user