diff --git a/erpnext/patches/may_2012/remove_euro_currency.py b/erpnext/patches/may_2012/remove_euro_currency.py new file mode 100644 index 0000000000..775532f35a --- /dev/null +++ b/erpnext/patches/may_2012/remove_euro_currency.py @@ -0,0 +1,16 @@ +def execute(): + """ + * Replace EURO with EUR + * Delete EURO from tabCurrency + """ + import webnotes + tables = webnotes.conn.sql("show tables") + for (tab,) in tables: + desc = webnotes.conn.sql("desc `%s`" % tab, as_dict=1) + for d in desc: + if "currency" in d.get('Field'): + field = d.get('Field') + webnotes.conn.sql("""\ + update `%s` set `%s`='EUR' + where `%s`='EURO'""" % (tab, field, field)) + webnotes.conn.sql("delete from `tabCurrency` where name='EURO'") \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index f8738e51e4..71c9436927 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -402,4 +402,9 @@ patch_list = [ 'patch_file': 'profile_perm_patch', 'description': 'Make profile readonly for role All' }, + { + 'patch_module': 'patches.may_2012', + 'patch_file': 'remove_euro_currency', + 'description': 'Remove EURO currency and replace with EUR' + }, ] \ No newline at end of file diff --git a/erpnext/utilities/doctype/address/address.js b/erpnext/utilities/doctype/address/address.js index 8949c5a9eb..c4631f8063 100644 --- a/erpnext/utilities/doctype/address/address.js +++ b/erpnext/utilities/doctype/address/address.js @@ -20,17 +20,17 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { var route = wn.get_route(); if(route[1]=='Supplier') { - var supplier = locals.Supplier[route[2]] + var supplier = wn.container.page.frm.doc; doc.supplier = supplier.name; doc.supplier_name = supplier.supplier_name; doc.address_type = 'Office'; } else if(route[1]=='Customer') { - var customer = locals.Customer[route[2]] + var customer = wn.container.page.frm.doc; doc.customer = customer.name; doc.customer_name = customer.customer_name; doc.address_type = 'Office'; } else if(route[1]=='Sales Partner') { - var sp = locals['Sales Partner'][route[2]]; + var sp = wn.container.page.frm.doc; doc.sales_partner = sp.name; doc.address_type = 'Office'; } diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js index ae06ed4203..1b0894ee21 100644 --- a/erpnext/utilities/doctype/contact/contact.js +++ b/erpnext/utilities/doctype/contact/contact.js @@ -21,18 +21,18 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { var route = wn.get_route(); if(route[1]=='Supplier') { - var supplier = locals.Supplier[route[2]] + var supplier = wn.container.page.frm.doc; doc.supplier = supplier.name; doc.supplier_name = supplier.supplier_name; } else if(route[1]=='Customer') { - var customer = locals.Customer[route[2]]; + var customer = wn.container.page.frm.doc; doc.customer = customer.name; doc.customer_name = customer.customer_name; if(customer.customer_type == 'Individual') { doc.first_name = customer.customer_name; } } else if(route[1]=='Sales Partner') { - var sp = locals['Sales Partner'][route[2]]; + var sp = wn.container.page.frm.doc; doc.sales_partner = sp.name; } }