fix: Update state code and union territory for Daman and Diu (#22989)

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
This commit is contained in:
Deepesh Garg
2020-08-12 19:34:23 +05:30
committed by GitHub
parent 5cc5bc246a
commit 1bb6ef3356
4 changed files with 26 additions and 10 deletions

View File

@@ -673,3 +673,4 @@ erpnext.patches.v12_0.set_italian_import_supplier_invoice_permissions
execute:frappe.reload_doc("HR", "doctype", "Employee Advance")
erpnext.patches.v12_0.move_due_advance_amount_to_pending_amount
erpnext.patches.v12_0.set_multi_uom_in_rfq
erpnext.patches.v12_0.update_state_code_for_daman_and_diu

View File

@@ -0,0 +1,22 @@
import frappe
from erpnext.regional.india import states
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
return
# Update options in gst_state custom field
gst_state = frappe.get_doc('Custom Field', 'Address-gst_state')
gst_state.options = '\n'.join(states)
gst_state.save()
# Update gst_state and state code in existing address
frappe.db.sql("""
UPDATE `tabAddress`
SET
gst_state = 'Dadra and Nagar Haveli and Daman and Diu',
gst_state_number = 26
WHERE gst_state = 'Daman and Diu'
""")

View File

@@ -10,8 +10,7 @@ states = [
'Bihar',
'Chandigarh',
'Chhattisgarh',
'Dadra and Nagar Haveli',
'Daman and Diu',
'Dadra and Nagar Haveli and Daman and Diu',
'Delhi',
'Goa',
'Gujarat',
@@ -50,8 +49,7 @@ state_numbers = {
"Bihar": "10",
"Chandigarh": "04",
"Chhattisgarh": "22",
"Dadra and Nagar Haveli": "26",
"Daman and Diu": "25",
"Dadra and Nagar Haveli and Daman and Diu": "26",
"Delhi": "07",
"Goa": "30",
"Gujarat": "24",

View File

@@ -134,15 +134,10 @@
"state_code": "DL",
"state_name": "Delhi"
},
{
"state_number": "25",
"state_code": "DD",
"state_name": "Daman and Diu"
},
{
"state_number": "26",
"state_code": "DN",
"state_name": "Dadra and Nagar Haveli"
"state_name": "Dadra and Nagar Haveli and Daman and Diu"
},
{
"state_number": "22",