remove euro currency patch, address / contact supplier/customer can now contain slashes in their name
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 0000000..775532f
--- /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 f8738e5..71c9436 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -402,4 +402,9 @@
'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 8949c5a..c4631f8 100644
--- a/erpnext/utilities/doctype/address/address.js
+++ b/erpnext/utilities/doctype/address/address.js
@@ -20,17 +20,17 @@
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 ae06ed4..1b0894e 100644
--- a/erpnext/utilities/doctype/contact/contact.js
+++ b/erpnext/utilities/doctype/contact/contact.js
@@ -21,18 +21,18 @@
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;
}
}