fixes in customerwise price list
This commit is contained in:
parent
ce02a74dbc
commit
32826a8cf1
@ -173,6 +173,7 @@ cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
|
|||||||
|
|
||||||
//Customer
|
//Customer
|
||||||
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
|
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
|
||||||
|
var pl = doc.price_list_name;
|
||||||
var callback = function(r,rt) {
|
var callback = function(r,rt) {
|
||||||
var callback2 = function(doc, dt, dn) {
|
var callback2 = function(doc, dt, dn) {
|
||||||
doc = locals[dt][dn];
|
doc = locals[dt][dn];
|
||||||
@ -180,7 +181,7 @@ cur_frm.cscript.customer = function(doc,dt,dn,onload) {
|
|||||||
get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,
|
get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,
|
||||||
function(doc, dt, dn) {
|
function(doc, dt, dn) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
if (!onload) cur_frm.cscript.price_list_name(doc, dt, dn);
|
if (!onload && (pl != doc.price_list_name)) cur_frm.cscript.price_list_name(doc, dt, dn);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,10 +100,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
//customer
|
//customer
|
||||||
cur_frm.cscript.customer = function(doc,dt,dn) {
|
cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||||
|
var pl = doc.price_list_name;
|
||||||
var callback = function(r,rt) {
|
var callback = function(r,rt) {
|
||||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
cur_frm.cscript.price_list_name(doc, dt, dn);
|
if (pl != doc.price_list_name) cur_frm.cscript.price_list_name(doc, dt, dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name),
|
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name),
|
||||||
|
|||||||
@ -143,23 +143,23 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
|
|||||||
unhide_field(['price_list_currency', 'plc_conversion_rate']);
|
unhide_field(['price_list_currency', 'plc_conversion_rate']);
|
||||||
|
|
||||||
if (pl_currency.length==1) {
|
if (pl_currency.length==1) {
|
||||||
set_multiple(cdt, cdn, {price_list_currency:pl_currency[0]});
|
if (doc.price_list_currency != pl_currency[0]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0]});
|
||||||
if (pl_currency[0] == doc.currency) {
|
if (pl_currency[0] == doc.currency) {
|
||||||
set_multiple(cdt, cdn, {plc_conversion_rate:doc.conversion_rate});
|
if(doc.plc_conversion_rate != doc.conversion_rate) set_multiple(cdt, cdn, {plc_conversion_rate:doc.conversion_rate});
|
||||||
hide_field(['price_list_currency', 'plc_conversion_rate']);
|
hide_field(['price_list_currency', 'plc_conversion_rate']);
|
||||||
} else if (pl_currency[0] == r.message[1]) {
|
} else if (pl_currency[0] == r.message[1]) {
|
||||||
set_multiple(cdt, cdn, {plc_conversion_rate:1})
|
if (doc.plc_conversion_rate != 1) set_multiple(cdt, cdn, {plc_conversion_rate:1})
|
||||||
hide_field(['price_list_currency', 'plc_conversion_rate']);
|
hide_field(['price_list_currency', 'plc_conversion_rate']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.message[1] == doc.currency) {
|
if (r.message[1] == doc.currency) {
|
||||||
set_multiple(cdt, cdn, {conversion_rate:1});
|
if (doc.conversion_rate != 1) set_multiple(cdt, cdn, {conversion_rate:1});
|
||||||
hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
|
hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
|
||||||
} else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
|
} else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
|
||||||
|
|
||||||
if (r.message[1] == doc.price_list_currency) {
|
if (r.message[1] == doc.price_list_currency) {
|
||||||
set_multiple(cdt, cdn, {plc_conversion_rate:1});
|
if (doc.plc_conversion_rate != 1) set_multiple(cdt, cdn, {plc_conversion_rate:1});
|
||||||
hide_field('plc_conversion_rate');
|
hide_field('plc_conversion_rate');
|
||||||
} else unhide_field('plc_conversion_rate');
|
} else unhide_field('plc_conversion_rate');
|
||||||
|
|
||||||
|
|||||||
@ -98,18 +98,20 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
//customer
|
//customer
|
||||||
cur_frm.cscript.customer = function(doc,dt,dn) {
|
cur_frm.cscript.customer = function(doc,dt,dn) {
|
||||||
|
var pl = doc.price_list_name;
|
||||||
var callback = function(r,rt) {
|
var callback = function(r,rt) {
|
||||||
var callback2 = function(r, rt) {
|
var callback2 = function(r, rt) {
|
||||||
|
|
||||||
if(doc.customer) unhide_field(['customer_address', 'contact_person', 'territory','customer_group','shipping_address']);
|
if(doc.customer) unhide_field(['customer_address', 'contact_person', 'territory','customer_group','shipping_address']);
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
if(!onload) cur_frm.cscript.price_list_name(doc, dt, dn);
|
|
||||||
|
if(!onload && (pl != doc.price_list_name)) cur_frm.cscript.price_list_name(doc, dt, dn);
|
||||||
|
|
||||||
}
|
}
|
||||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||||
get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,11 +79,12 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
//customer
|
//customer
|
||||||
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
|
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
|
||||||
|
var pl = doc.price_list_name;
|
||||||
var callback = function(r,rt) {
|
var callback = function(r,rt) {
|
||||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||||
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();
|
cur_frm.refresh();
|
||||||
if(!onload) cur_frm.cscript.price_list_name(doc, dt, dn);
|
if(!onload && (pl != doc.price_list_name)) cur_frm.cscript.price_list_name(doc, dt, dn);
|
||||||
}
|
}
|
||||||
var args = onload ? 'onload':''
|
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) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user