[contact/address] fixed auto setting closes #475 (erpnext)

This commit is contained in:
Rushabh Mehta
2013-06-14 13:29:20 +05:30
parent 1475e4d295
commit 37982a6a1f
18 changed files with 91 additions and 211 deletions

View File

@@ -59,19 +59,6 @@ cur_frm.cscript.make_address = function() {
parent: cur_frm.fields_dict['address_html'].wrapper,
page_length: 5,
new_doctype: "Address",
custom_new_doc: function(doctype) {
var address = wn.model.make_new_doc_and_get_name('Address');
address = locals['Address'][address];
address.customer = cur_frm.doc.name;
address.customer_name = cur_frm.doc.customer_name;
address.address_title = cur_frm.doc.customer_name;
if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) {
address.address_type = "Office";
}
wn.set_route("Form", "Address", address.name);
},
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 customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
},
@@ -89,16 +76,6 @@ cur_frm.cscript.make_contact = function() {
cur_frm.contact_list = new wn.ui.Listing({
parent: cur_frm.fields_dict['contact_html'].wrapper,
page_length: 5,
custom_new_doc: function(doctype) {
var contact = wn.model.make_new_doc_and_get_name('Contact');
contact = locals['Contact'][contact];
contact.customer = cur_frm.doc.name;
contact.customer_name = cur_frm.doc.customer_name;
if(cur_frm.doc.customer_type == 'Individual') {
contact.first_name = cur_frm.doc.customer_name;
}
wn.set_route("Form", "Contact", contact.name);
},
new_doctype: "Contact",
get_query: function() {
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"