[Mod] Code refactored to remove dependency on 'complete_address' field
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 55aaa02..1994bd3 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -43,6 +43,18 @@
})
},
customer_primary_address: function(frm){
+ if(frm.doc.customer_primary_address){
+ frappe.call({
+ doc: frm.doc,
+ args: {
+ "address_title":frm.doc.customer_primary_address
+ },
+ method: 'get_display',
+ callback: function(r) {
+ frm.set_value("primary_address",r.message);
+ }
+ });
+ }
if(!frm.doc.customer_primary_address){
frm.set_value("primary_address", "");
}
@@ -92,4 +104,4 @@
validate: function(frm) {
if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
},
-});
+});
\ No newline at end of file
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index 2c846cf..d43de10 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -924,7 +924,7 @@
"label": "Primary Address",
"length": 0,
"no_copy": 0,
- "options": "customer_primary_address.complete_address",
+ "options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -1449,7 +1449,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-02-02 16:07:11.052268",
+ "modified": "2018-02-09 10:44:35.801716",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 6f25bf7..94aeed9 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -77,6 +77,10 @@
if self.flags.is_new_doc and self.get('address_line1'):
make_address(self)
+ def get_display(self,address_title):
+ from frappe.contacts.doctype.address.address import get_address_display
+ return get_address_display(address_title)
+
def update_lead_status(self):
'''If Customer created from Lead, update lead status to "Converted"
update Customer link in Quotation, Opportunity'''