Merge branch 'shf_rename' of github.com:webnotes/erpnext into shf_rename
This commit is contained in:
commit
551a226368
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,7 +142,7 @@ class DocType:
|
|||||||
r['value'] = float(r['debit'] - r['credit'])
|
r['value'] = float(r['debit'] - r['credit'])
|
||||||
#webnotes.msgprint(query)
|
#webnotes.msgprint(query)
|
||||||
#webnotes.msgprint(res)
|
#webnotes.msgprint(res)
|
||||||
result[query] = (res and len(res)==1) and res[0] or (res and res or None)
|
result[query] = res and (len(res)==1 and res[0]) or (res or None)
|
||||||
if result[query] is None:
|
if result[query] is None:
|
||||||
del result[query]
|
del result[query]
|
||||||
|
|
||||||
@ -502,127 +502,160 @@ class DocType:
|
|||||||
body_dict = {
|
body_dict = {
|
||||||
|
|
||||||
'invoiced_amount': {
|
'invoiced_amount': {
|
||||||
'table': 'invoiced_amount' in result and table({
|
'table': result.get('invoiced_amount') and \
|
||||||
'head': 'Invoiced Amount',
|
table({
|
||||||
'body': currency_amount_str \
|
'head': 'Invoiced Amount',
|
||||||
% (currency, fmt_money(result['invoiced_amount']['debit']))
|
'body': currency_amount_str \
|
||||||
}),
|
% (currency, fmt_money(result['invoiced_amount'].get('debit')))
|
||||||
'idx': 300
|
}),
|
||||||
|
'idx': 300,
|
||||||
|
'value': result.get('invoiced_amount') and result['invoiced_amount'].get('debit')
|
||||||
},
|
},
|
||||||
|
|
||||||
'payables': {
|
'payables': {
|
||||||
'table': 'payables' in result and table({
|
'table': result.get('payables') and \
|
||||||
'head': 'Payables',
|
table({
|
||||||
'body': currency_amount_str \
|
'head': 'Payables',
|
||||||
% (currency, fmt_money(result['payables']['credit']))
|
'body': currency_amount_str \
|
||||||
}),
|
% (currency, fmt_money(result['payables'].get('credit')))
|
||||||
'idx': 200
|
}),
|
||||||
|
'idx': 200,
|
||||||
|
'value': result.get('payables') and result['payables'].get('credit')
|
||||||
},
|
},
|
||||||
|
|
||||||
'collections': {
|
'collections': {
|
||||||
'table': 'collections' in result and table({
|
'table': result.get('collections') and \
|
||||||
'head': 'Collections',
|
table({
|
||||||
'body': currency_amount_str \
|
'head': 'Collections',
|
||||||
% (currency, fmt_money(result['collections']['credit']))
|
'body': currency_amount_str \
|
||||||
}),
|
% (currency, fmt_money(result['collections'].get('credit')))
|
||||||
'idx': 301
|
}),
|
||||||
|
'idx': 301,
|
||||||
|
'value': result.get('collections') and result['collections'].get('credit')
|
||||||
},
|
},
|
||||||
|
|
||||||
'payments': {
|
'payments': {
|
||||||
'table': 'payments' in result and table({
|
'table': result.get('payments') and \
|
||||||
'head': 'Payments',
|
table({
|
||||||
'body': currency_amount_str \
|
'head': 'Payments',
|
||||||
% (currency, fmt_money(result['payments']['debit']))
|
'body': currency_amount_str \
|
||||||
}),
|
% (currency, fmt_money(result['payments'].get('debit')))
|
||||||
'idx': 201
|
}),
|
||||||
|
'idx': 201,
|
||||||
|
'value': result.get('payments') and result['payments'].get('debit')
|
||||||
},
|
},
|
||||||
|
|
||||||
'income': {
|
'income': {
|
||||||
'table': 'income' in result and table({
|
'table': result.get('income') and \
|
||||||
'head': 'Income',
|
table({
|
||||||
'body': currency_amount_str \
|
'head': 'Income',
|
||||||
% (currency, fmt_money(result['income']['value']))
|
'body': currency_amount_str \
|
||||||
}),
|
% (currency, fmt_money(result['income'].get('value')))
|
||||||
'idx': 302
|
}),
|
||||||
|
'idx': 302,
|
||||||
|
'value': result.get('income') and result['income'].get('value')
|
||||||
},
|
},
|
||||||
|
|
||||||
'income_year_to_date': {
|
'income_year_to_date': {
|
||||||
'table': 'income_year_to_date' in result and table({
|
'table': result.get('income_year_to_date') and \
|
||||||
'head': 'Income Year To Date',
|
table({
|
||||||
'body': currency_amount_str \
|
'head': 'Income Year To Date',
|
||||||
% (currency, fmt_money(result['income_year_to_date']['value']))
|
'body': currency_amount_str \
|
||||||
}),
|
% (currency, fmt_money(result['income_year_to_date'].get('value')))
|
||||||
'idx': 303
|
}),
|
||||||
|
'idx': 303,
|
||||||
|
'value': result.get('income_year_to_date') and \
|
||||||
|
result['income_year_to_date'].get('value')
|
||||||
},
|
},
|
||||||
|
|
||||||
'expenses_booked': {
|
'expenses_booked': {
|
||||||
'table': 'expenses_booked' in result and table({
|
'table': result.get('expenses_booked') and \
|
||||||
'head': 'Expenses Booked',
|
table({
|
||||||
'body': currency_amount_str \
|
'head': 'Expenses Booked',
|
||||||
% (currency, fmt_money(result['expenses_booked']['value']))
|
'body': currency_amount_str \
|
||||||
}),
|
% (currency, fmt_money(result['expenses_booked'].get('value')))
|
||||||
'idx': 202
|
}),
|
||||||
|
'idx': 202,
|
||||||
|
'value': result.get('expenses_booked') and result['expenses_booked'].get('value')
|
||||||
},
|
},
|
||||||
|
|
||||||
'bank_balance': {
|
'bank_balance': {
|
||||||
'table': 'bank_balance' in result and result['bank_balance'] and table({
|
'table': result.get('bank_balance') and \
|
||||||
'head': 'Bank Balance',
|
table({
|
||||||
'body': [
|
'head': 'Bank Balance',
|
||||||
[
|
'body': [
|
||||||
"<span style='font-size: 16px; font-weight: normal'>%s</span>" % bank['name'],
|
[
|
||||||
currency_amount_str % (currency, fmt_money(bank['value']))
|
"<span style='font-size: 16px; font-weight: normal'>%s</span>" \
|
||||||
] for bank in result.get('bank_balance', [])
|
% bank['name'],
|
||||||
]
|
currency_amount_str % (currency, fmt_money(bank.get('value')))
|
||||||
}),
|
] for bank in (isinstance(result['bank_balance'], list) and \
|
||||||
'idx': 400
|
result['bank_balance'] or \
|
||||||
|
[result['bank_balance']])
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
'idx': 0,
|
||||||
|
'value': 0.1
|
||||||
},
|
},
|
||||||
|
|
||||||
'new_leads': {
|
'new_leads': {
|
||||||
'table': 'new_leads' in result and table({
|
'table': result.get('new_leads') and \
|
||||||
'head': 'New Leads',
|
table({
|
||||||
'body': '%s' % result['new_leads']['count']
|
'head': 'New Leads',
|
||||||
}),
|
'body': '%s' % result['new_leads'].get('count')
|
||||||
'idx': 100
|
}),
|
||||||
|
'idx': 100,
|
||||||
|
'value': result.get('new_leads') and result['new_leads'].get('count')
|
||||||
},
|
},
|
||||||
|
|
||||||
'new_enquiries': {
|
'new_enquiries': {
|
||||||
'table': 'new_enquiries' in result and table({
|
'table': result.get('new_enquiries') and \
|
||||||
'head': 'New Enquiries',
|
table({
|
||||||
'body': '%s' % result['new_enquiries']['count']
|
'head': 'New Enquiries',
|
||||||
}),
|
'body': '%s' % result['new_enquiries'].get('count')
|
||||||
'idx': 101
|
}),
|
||||||
|
'idx': 101,
|
||||||
|
'value': result.get('new_enquiries') and result['new_enquiries'].get('count')
|
||||||
},
|
},
|
||||||
|
|
||||||
'new_quotations': {
|
'new_quotations': {
|
||||||
'table': 'new_quotations' in result and table({
|
'table': result.get('new_quotations') and \
|
||||||
'head': 'New Quotations',
|
table({
|
||||||
'body': '%s' % result['new_quotations']['count']
|
'head': 'New Quotations',
|
||||||
}),
|
'body': '%s' % result['new_quotations'].get('count')
|
||||||
'idx': 102
|
}),
|
||||||
|
'idx': 102,
|
||||||
|
'value': result.get('new_quotations') and result['new_quotations'].get('count')
|
||||||
},
|
},
|
||||||
|
|
||||||
'new_sales_orders': {
|
'new_sales_orders': {
|
||||||
'table': 'new_sales_orders' in result and table({
|
'table': result.get('new_sales_orders') and \
|
||||||
'head': 'New Sales Orders',
|
table({
|
||||||
'body': '%s' % result['new_sales_orders']['count']
|
'head': 'New Sales Orders',
|
||||||
}),
|
'body': '%s' % result['new_sales_orders'].get('count')
|
||||||
'idx': 103
|
}),
|
||||||
|
'idx': 103,
|
||||||
|
'value': result.get('new_sales_orders') and result['new_sales_orders'].get('count')
|
||||||
},
|
},
|
||||||
|
|
||||||
'new_purchase_orders': {
|
'new_purchase_orders': {
|
||||||
'table': 'new_purchase_orders' in result and table({
|
'table': result.get('new_purchase_orders') and \
|
||||||
'head': 'New Purchase Orders',
|
table({
|
||||||
'body': '%s' % result['new_purchase_orders']['count']
|
'head': 'New Purchase Orders',
|
||||||
}),
|
'body': '%s' % result['new_purchase_orders'].get('count')
|
||||||
'idx': 104
|
}),
|
||||||
|
'idx': 104,
|
||||||
|
'value': result.get('new_purchase_orders') and \
|
||||||
|
result['new_purchase_orders'].get('count')
|
||||||
},
|
},
|
||||||
|
|
||||||
'new_transactions': {
|
'new_transactions': {
|
||||||
'table': 'new_transactions' in result and table({
|
'table': result.get('new_transactions') and \
|
||||||
'head': 'New Transactions',
|
table({
|
||||||
'body': '%s' % result['new_transactions']['count']
|
'head': 'New Transactions',
|
||||||
}),
|
'body': '%s' % result['new_transactions'].get('count')
|
||||||
'idx': 105
|
}),
|
||||||
|
'idx': 105,
|
||||||
|
'value': result.get('new_transactions') and result['new_transactions'].get('count')
|
||||||
}
|
}
|
||||||
|
|
||||||
#'stock_below_rl':
|
#'stock_below_rl':
|
||||||
@ -631,11 +664,20 @@ class DocType:
|
|||||||
table_list = []
|
table_list = []
|
||||||
|
|
||||||
# Sort these keys depending on idx value
|
# Sort these keys depending on idx value
|
||||||
bd_keys = sorted(body_dict, key=lambda x: body_dict[x]['idx'])
|
bd_keys = sorted(body_dict, key=lambda x: \
|
||||||
|
(-webnotes.utils.flt(body_dict[x]['value']), body_dict[x]['idx']))
|
||||||
|
|
||||||
|
new_section = False
|
||||||
|
|
||||||
for k in bd_keys:
|
for k in bd_keys:
|
||||||
if self.doc.fields[k]:
|
if self.doc.fields[k]:
|
||||||
if k in result:
|
if k in result:
|
||||||
|
if not body_dict[k].get('value') and not new_section:
|
||||||
|
if len(table_list) % 2 != 0:
|
||||||
|
table_list.append("")
|
||||||
|
table_list.append("<hr />")
|
||||||
|
table_list.append("<hr />")
|
||||||
|
new_section = True
|
||||||
table_list.append(body_dict[k]['table'])
|
table_list.append(body_dict[k]['table'])
|
||||||
elif k in ['collections', 'payments']:
|
elif k in ['collections', 'payments']:
|
||||||
table_list.append(\
|
table_list.append(\
|
||||||
|
|||||||
@ -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