Merge pull request #9501 from saurabh6790/gst_patch_fix
[fix] delete custom field tax_id if exists in transaction Sales Order, Sales Invoice and Delivery Note
diff --git a/erpnext/patches/v8_1/setup_gst_india.py b/erpnext/patches/v8_1/setup_gst_india.py
index efdb9c5..374c738 100644
--- a/erpnext/patches/v8_1/setup_gst_india.py
+++ b/erpnext/patches/v8_1/setup_gst_india.py
@@ -12,9 +12,16 @@
if frappe.db.get_single_value('System Settings', 'country')=='India':
from erpnext.regional.india.setup import setup
+ delete_custom_field_tax_id_if_exists()
setup(patch=True)
send_gst_update_email()
+def delete_custom_field_tax_id_if_exists():
+ for field in frappe.db.sql_list("""select name from `tabCustom Field` where fieldname='tax_id'
+ and dt in ('Sales Order', 'Salse Invoice', 'Delivery Note')"""):
+ frappe.delete_doc("Custom Field", field, ignore_permissions=True)
+ frappe.db.commit()
+
def send_gst_update_email():
message = """Hello,