mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
[contact/address] fixed auto setting closes #475 (erpnext)
This commit is contained in:
@@ -56,17 +56,6 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
|
||||
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
||||
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
||||
locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
||||
locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
|
||||
@@ -49,19 +49,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.supplier = cur_frm.doc.name;
|
||||
address.supplier_name = cur_frm.doc.supplier_name;
|
||||
address.address_title = cur_frm.doc.supplier_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 supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||
},
|
||||
@@ -80,13 +67,6 @@ cur_frm.cscript.make_contact = function() {
|
||||
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
||||
page_length: 5,
|
||||
new_doctype: "Contact",
|
||||
custom_new_doc: function(doctype) {
|
||||
var contact = wn.model.make_new_doc_and_get_name('Contact');
|
||||
contact = locals['Contact'][contact];
|
||||
contact.supplier = cur_frm.doc.name;
|
||||
contact.supplier_name = cur_frm.doc.supplier_name;
|
||||
wn.set_route("Form", "Contact", contact.name);
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||
},
|
||||
|
||||
@@ -87,13 +87,3 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
department, designation FROM tabContact WHERE supplier = \"" + doc.supplier
|
||||
+"\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50";
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
|
||||
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
||||
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
||||
locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
||||
locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
||||
}
|
||||
Reference in New Issue
Block a user