sales team mapping issue in SO-DN and SO-RV

This commit is contained in:
Nabin Hait 2012-02-14 15:13:21 +05:30
parent 05f4c290ec
commit 84d73103f8
3 changed files with 14 additions and 9 deletions

View File

@ -38,7 +38,7 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
'load_default_accounts','',
function(r,rt) {
refresh_field('entries');
cur_frm.cscript.customer(doc,dt,dn);
cur_frm.cscript.customer(doc,dt,dn,onload=true);
}
);
}
@ -137,18 +137,21 @@ cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
//Customer
cur_frm.cscript.customer = function(doc,dt,dn) {
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
get_server_fields('get_debit_to','','',doc, dt, dn, 0);
cur_frm.refresh();
}
var args = onload ? 'onload':''
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback);
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','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
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);
}

View File

@ -61,12 +61,13 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
//customer
cur_frm.cscript.customer = function(doc,dt,dn) {
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh();
}
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', '', callback);
var args = onload ? 'onload':''
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
}
@ -112,7 +113,7 @@ cur_frm.cscript['Get Items'] = function(doc,dt,dn) {
cur_frm.cscript.pull_item_details_onload = function(doc,dt,dn){
var callback = function(r,rt){
refresh_field('delivery_note_details');
cur_frm.cscript.customer(doc,dt,dn);
cur_frm.cscript.customer(doc,dt,dn,onload=true);
}
$c_obj(make_doclist(dt,dn),'set_item_details','',callback);
}

View File

@ -19,6 +19,7 @@ class TransactionBase:
self.doc.contact_mobile = contact_mobile or ''
self.get_customer_details(self.doc.customer)
if args != 'onload':
self.get_sales_person(self.doc.customer)
# Get Customer Default Shipping Address - first load
@ -34,7 +35,7 @@ class TransactionBase:
self.doc.contact_mobile = contact_mobile or ''
self.get_customer_details(self.doc.customer)
if self.doc.doctype != 'Quotation':
if self.doc.doctype != 'Quotation' and args != 'onload':
self.get_sales_person(self.doc.customer)
# Get Customer Address