From 07913c3ff26ef9d711920b8d298ef7718d1d45a2 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 28 Jun 2017 13:16:42 +0530 Subject: [PATCH] [fix] delete custom field tax_id if exists in trasaction Sales Order, Sales Invoice and Delivery Note --- erpnext/patches/v8_1/setup_gst_india.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/patches/v8_1/setup_gst_india.py b/erpnext/patches/v8_1/setup_gst_india.py index efdb9c5e9f..374c738f13 100644 --- a/erpnext/patches/v8_1/setup_gst_india.py +++ b/erpnext/patches/v8_1/setup_gst_india.py @@ -12,9 +12,16 @@ def execute(): 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,