[minor] [ux] address refresh for lead

This commit is contained in:
Rushabh Mehta 2014-11-24 15:18:40 +05:30
parent 0a7abc188e
commit 2f4567fa3c
2 changed files with 1 additions and 24 deletions

View File

@ -44,29 +44,6 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
}
},
make_address_list: function() {
var me = this;
if(!this.frm.address_list) {
this.frm.address_list = new frappe.ui.Listing({
parent: this.frm.fields_dict['address_html'].wrapper,
page_length: 5,
new_doctype: "Address",
get_query: function() {
return 'select name, address_type, address_line1, address_line2, \
city, state, country, pincode, fax, email_id, phone, \
is_primary_address, is_shipping_address from tabAddress \
where lead="'+me.frm.doc.name+'" and docstatus != 2 \
order by is_primary_address, is_shipping_address desc'
},
as_dict: 1,
no_results_message: __('No addresses created'),
render_row: this.render_address_row,
});
// note: render_address_row is defined in contact_control.js
}
this.frm.address_list.run();
},
create_customer: function() {
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.lead.lead.make_customer",

View File

@ -5,7 +5,7 @@
frappe.ui.form.on("Address", "validate", function(frm) {
// clear linked customer / supplier / sales partner on saving...
$.each(["Customer", "Supplier", "Sales Partner"], function(i, doctype) {
$.each(["Customer", "Supplier", "Sales Partner", "Lead"], function(i, doctype) {
var name = frm.doc[doctype.toLowerCase().replace(/ /g, "_")];
if(name && locals[doctype] && locals[doctype][name])
frappe.model.remove_from_locals(doctype, name);