Browse Source

[Mod] Code refactored to remove dependency on 'complete_address' field

develop
Saurabh 7 years ago
parent
commit
b4ab89e1da
  1. 14
      erpnext/selling/doctype/customer/customer.js
  2. 4
      erpnext/selling/doctype/customer/customer.json
  3. 4
      erpnext/selling/doctype/customer/customer.py

14
erpnext/selling/doctype/customer/customer.js

@ -43,6 +43,18 @@ frappe.ui.form.on("Customer", {
})
},
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 @@ frappe.ui.form.on("Customer", {
validate: function(frm) {
if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
},
});
});

4
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",

4
erpnext/selling/doctype/customer/customer.py

@ -77,6 +77,10 @@ class Customer(TransactionBase):
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'''

Loading…
Cancel
Save