From 063141d1526762b261830a6f43f47bf5bd53935e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 28 Feb 2014 11:37:36 +0530 Subject: [PATCH] added patch for address --- erpnext/patches.txt | 1 + erpnext/patches/4_0/fix_contact_address.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 erpnext/patches/4_0/fix_contact_address.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a6efd5a523..f88c84e718 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -21,3 +21,4 @@ execute:frappe.reload_doc('hr', 'doctype', 'employee') # 2014-02-03 execute:frappe.db.sql("update tabPage set module='Core' where name='Setup'") erpnext.patches.4_0.fields_to_be_renamed erpnext.patches.4_0.rename_sitemap_to_route +erpnext.patches.4_0.fix_contact_address diff --git a/erpnext/patches/4_0/fix_contact_address.py b/erpnext/patches/4_0/fix_contact_address.py new file mode 100644 index 0000000000..4bf81b3ad8 --- /dev/null +++ b/erpnext/patches/4_0/fix_contact_address.py @@ -0,0 +1,12 @@ +import frappe + +def execute(): + frappe.reload_doc("website", "doctype", "contact_us_settings") + address = frappe.db.get_value("Contact Us Settings", None, "address") + if address: + address = frappe.doc("Address", address) + contact = frappe.bean("Contact Us Settings", "Contact Us Settings") + for f in ("address_title", "address_line1", "address_line2", "city", "state", "country", "pincode"): + contact.doc.fields[f] = address.get(f) + + contact.save() \ No newline at end of file