[patch][fix] update gst_state only if company country is india
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 8991c36..fd985d0 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -415,5 +415,5 @@
erpnext.patches.v8_0.update_production_orders
erpnext.patches.v8_1.remove_sales_invoice_from_returned_serial_no
erpnext.patches.v8_1.allow_invoice_copy_to_edit_after_submit
-erpnext.patches.v8_1.update_gst_state
-erpnext.patches.v8_1.add_hsn_sac_codes
\ No newline at end of file
+erpnext.patches.v8_1.add_hsn_sac_codes
+erpnext.patches.v8_1.update_gst_state
\ No newline at end of file
diff --git a/erpnext/patches/v8_1/update_gst_state.py b/erpnext/patches/v8_1/update_gst_state.py
index 2bbb6b8..88fe6eb 100644
--- a/erpnext/patches/v8_1/update_gst_state.py
+++ b/erpnext/patches/v8_1/update_gst_state.py
@@ -2,5 +2,12 @@
from erpnext.regional.india import states
def execute():
+ company = frappe.get_all('Company', filters = {'country': 'India'})
+ if not company:
+ return
+
+ if not frappe.db.get_value("Custom Field", filters={'fieldname':'gst_state'}):
+ return
+
frappe.db.sql("update `tabCustom Field` set options=%s where fieldname='gst_state'", '\n'.join(states))
frappe.db.sql("update `tabAddress` set gst_state='Chhattisgarh' where gst_state='Chattisgarh'")