mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 03:01:22 +00:00
Merge branch 'master' of github.com:webnotes/erpnext into edge
This commit is contained in:
@@ -25,6 +25,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
||||
cur_frm.add_custom_button('Opportunity Lost', cur_frm.cscript['Declare Opportunity Lost']);
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
}
|
||||
|
||||
cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
|
||||
|
||||
}
|
||||
|
||||
// ONLOAD
|
||||
@@ -79,7 +82,7 @@ cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
|
||||
}
|
||||
|
||||
// hide - unhide fields based on lead or customer
|
||||
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
||||
if(doc.enquiry_from == 'Lead'){
|
||||
unhide_field(['lead']);
|
||||
hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
@@ -87,13 +90,15 @@ cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
||||
}
|
||||
else if(doc.enquiry_from == 'Customer'){
|
||||
unhide_field(['customer']);
|
||||
hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);
|
||||
hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory', 'customer_group']);
|
||||
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
|
||||
}
|
||||
}
|
||||
|
||||
// customer
|
||||
cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||
cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
|
||||
|
||||
if(doc.customer) {
|
||||
cur_frm.call({
|
||||
doc: cur_frm.doc,
|
||||
@@ -127,11 +132,18 @@ cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return 'SELECT name, address_line1, city FROM tabAddress \
|
||||
WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
|
||||
%(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
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 customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
if (!doc.customer) msgprint("Please select customer first");
|
||||
else {
|
||||
return 'SELECT name, CONCAT(first_name," ",ifnull(last_name,"")) As FullName, \
|
||||
department, designation FROM tabContact WHERE customer = "'+ doc.customer +
|
||||
'" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
}
|
||||
|
||||
// lead
|
||||
@@ -140,6 +152,8 @@ cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
|
||||
}
|
||||
|
||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
|
||||
|
||||
if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
|
||||
if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);
|
||||
}
|
||||
|
||||
@@ -93,9 +93,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
erpnext.hide_naming_series();
|
||||
|
||||
if(doc.customer || doc.lead) $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
|
||||
else $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false);
|
||||
cur_frm.toggle_display("contact_section", doc.customer || doc.lead);
|
||||
|
||||
if (!doc.__islocal) {
|
||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||
@@ -120,6 +118,8 @@ cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name),
|
||||
'get_default_customer_address', '', callback);
|
||||
if(doc.customer) unhide_field(['customer_address','contact_person','territory', 'customer_group']);
|
||||
cur_frm.toggle_display("contact_section", doc.customer || doc.lead);
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
@@ -130,27 +130,11 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
||||
}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
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 customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.lead.get_query = erpnext.utils.lead_query;
|
||||
|
||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_display("contact_section", doc.customer || doc.lead);
|
||||
|
||||
if(doc.lead) {
|
||||
get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
|
||||
unhide_field('territory');
|
||||
|
||||
@@ -320,7 +320,27 @@ cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field('batch_no').get_query
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name, address_line1, city FROM tabAddress \
|
||||
WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
|
||||
%(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
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 customer = "'+ doc.customer +
|
||||
'" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
// *********************** QUANTITY ***************************
|
||||
cur_frm.cscript.qty = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
|
||||
|
||||
@@ -36,7 +36,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
// load default charges
|
||||
|
||||
if(doc.__islocal && !doc.customer){
|
||||
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
hide_field(['customer_address','contact_person', 'customer_name',
|
||||
'address_display', 'contact_display', 'contact_mobile',
|
||||
'contact_email', 'territory', 'customer_group']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +61,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
|
||||
|
||||
if(doc.customer) $(cur_frm.fields_dict.contact_info.row.wrapper).toggle(true);
|
||||
else $(cur_frm.fields_dict.contact_info.row.wrapper).toggle(false);
|
||||
|
||||
cur_frm.toggle_display("contact_info", doc.customer);
|
||||
|
||||
if(doc.docstatus==1) {
|
||||
if(doc.status != 'Stopped') {
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
@@ -105,11 +106,13 @@ cur_frm.cscript.order_type = function(doc) {
|
||||
|
||||
//customer
|
||||
cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||
cur_frm.toggle_display("contact_info", doc.customer);
|
||||
|
||||
var pl = doc.price_list_name;
|
||||
var callback = function(r,rt) {
|
||||
var callback2 = function(r, rt) {
|
||||
|
||||
if(doc.customer) unhide_field(['customer_address', 'contact_person', 'territory','customer_group']);
|
||||
if(doc.customer)
|
||||
unhide_field(['customer_address', 'contact_person', 'territory','customer_group']);
|
||||
cur_frm.refresh();
|
||||
|
||||
if(!onload && (pl != doc.price_list_name)) cur_frm.cscript.price_list_name(doc, dt, dn);
|
||||
@@ -119,38 +122,22 @@ cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||
get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2);
|
||||
|
||||
}
|
||||
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
|
||||
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name),
|
||||
'get_default_customer_address', '', callback);
|
||||
}
|
||||
|
||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
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 customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
|
||||
var callback = function(r,rt){
|
||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||
if(!r.exc){
|
||||
doc.quotation_no = r.message;
|
||||
if(doc.quotation_no) {
|
||||
unhide_field(['quotation_date', 'customer_address', 'contact_person', 'territory', 'customer_group']);
|
||||
unhide_field(['quotation_date', 'customer_address',
|
||||
'contact_person', 'territory', 'customer_group']);
|
||||
if(doc.customer) get_server_fields('get_shipping_address', doc.customer, '', doc, dt, dn, 0);
|
||||
}
|
||||
cur_frm.refresh();
|
||||
|
||||
Reference in New Issue
Block a user