Merge branch 'shf_rename' of github.com:webnotes/erpnext into shf_rename

This commit is contained in:
Anand Doshi 2012-05-03 13:23:32 +05:30
commit 47fac1804b
5 changed files with 15 additions and 10 deletions

View File

@ -173,6 +173,7 @@ cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
//Customer
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var pl = doc.price_list_name;
var callback = function(r,rt) {
var callback2 = function(doc, 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,
function(doc, dt, dn) {
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);
});
}

View File

@ -100,10 +100,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
//customer
cur_frm.cscript.customer = function(doc,dt,dn) {
var pl = doc.price_list_name;
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
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),

View File

@ -143,23 +143,23 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
unhide_field(['price_list_currency', 'plc_conversion_rate']);
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) {
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']);
} 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']);
}
}
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']);
} else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
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');
} else unhide_field('plc_conversion_rate');

View File

@ -98,18 +98,20 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
//customer
cur_frm.cscript.customer = function(doc,dt,dn) {
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','shipping_address']);
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];
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);
}

View File

@ -79,11 +79,12 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
//customer
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var pl = doc.price_list_name;
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
if(doc.customer) unhide_field(['customer_address','contact_person','territory','customer_group']);
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':''
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback);