email digest fixes

This commit is contained in:
Anand Doshi 2012-05-03 12:37:26 +05:30
parent 3d0c9ba22d
commit e5982c0399

View File

@ -502,125 +502,140 @@ class DocType:
body_dict = { body_dict = {
'invoiced_amount': { 'invoiced_amount': {
'table': 'invoiced_amount' in result and table({ 'table': result.get('invoiced_amount') and \
table({
'head': 'Invoiced Amount', 'head': 'Invoiced Amount',
'body': currency_amount_str \ 'body': currency_amount_str \
% (currency, fmt_money(result['invoiced_amount']['debit'])) % (currency, fmt_money(result['invoiced_amount'].get('debit')))
}), }),
'idx': 300 'idx': 300
}, },
'payables': { 'payables': {
'table': 'payables' in result and table({ 'table': result.get('payables') and \
table({
'head': 'Payables', 'head': 'Payables',
'body': currency_amount_str \ 'body': currency_amount_str \
% (currency, fmt_money(result['payables']['credit'])) % (currency, fmt_money(result['payables'].get('credit')))
}), }),
'idx': 200 'idx': 200
}, },
'collections': { 'collections': {
'table': 'collections' in result and table({ 'table': result.get('collections') and \
table({
'head': 'Collections', 'head': 'Collections',
'body': currency_amount_str \ 'body': currency_amount_str \
% (currency, fmt_money(result['collections']['credit'])) % (currency, fmt_money(result['collections'].get('credit')))
}), }),
'idx': 301 'idx': 301
}, },
'payments': { 'payments': {
'table': 'payments' in result and table({ 'table': result.get('payments') and \
table({
'head': 'Payments', 'head': 'Payments',
'body': currency_amount_str \ 'body': currency_amount_str \
% (currency, fmt_money(result['payments']['debit'])) % (currency, fmt_money(result['payments'].get('debit')))
}), }),
'idx': 201 'idx': 201
}, },
'income': { 'income': {
'table': 'income' in result and table({ 'table': result.get('income') and \
table({
'head': 'Income', 'head': 'Income',
'body': currency_amount_str \ 'body': currency_amount_str \
% (currency, fmt_money(result['income']['value'])) % (currency, fmt_money(result['income'].get('value')))
}), }),
'idx': 302 'idx': 302
}, },
'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 \
table({
'head': 'Income Year To Date', 'head': 'Income Year To Date',
'body': currency_amount_str \ 'body': currency_amount_str \
% (currency, fmt_money(result['income_year_to_date']['value'])) % (currency, fmt_money(result['income_year_to_date'].get('value')))
}), }),
'idx': 303 'idx': 303
}, },
'expenses_booked': { 'expenses_booked': {
'table': 'expenses_booked' in result and table({ 'table': result.get('expenses_booked') and \
table({
'head': 'Expenses Booked', 'head': 'Expenses Booked',
'body': currency_amount_str \ 'body': currency_amount_str \
% (currency, fmt_money(result['expenses_booked']['value'])) % (currency, fmt_money(result['expenses_booked'].get('value')))
}), }),
'idx': 202 'idx': 202
}, },
'bank_balance': { 'bank_balance': {
'table': 'bank_balance' in result and result['bank_balance'] and table({ 'table': result.get('bank_balance') and \
table({
'head': 'Bank Balance', 'head': 'Bank Balance',
'body': [ 'body': [
[ [
"<span style='font-size: 16px; font-weight: normal'>%s</span>" % bank['name'], "<span style='font-size: 16px; font-weight: normal'>%s</span>" \
currency_amount_str % (currency, fmt_money(bank['value'])) % bank['name'],
] for bank in result.get('bank_balance', []) currency_amount_str % (currency, fmt_money(bank.get('value')))
] for bank in result['bank_balance']
] ]
}), }),
'idx': 400 'idx': 400
}, },
'new_leads': { 'new_leads': {
'table': 'new_leads' in result and table({ 'table': result.get('new_leads') and \
table({
'head': 'New Leads', 'head': 'New Leads',
'body': '%s' % result['new_leads']['count'] 'body': '%s' % result['new_leads'].get('count')
}), }),
'idx': 100 'idx': 100
}, },
'new_enquiries': { 'new_enquiries': {
'table': 'new_enquiries' in result and table({ 'table': result.get('new_enquiries') and \
table({
'head': 'New Enquiries', 'head': 'New Enquiries',
'body': '%s' % result['new_enquiries']['count'] 'body': '%s' % result['new_enquiries'].get('count')
}), }),
'idx': 101 'idx': 101
}, },
'new_quotations': { 'new_quotations': {
'table': 'new_quotations' in result and table({ 'table': result.get('new_quotations') and \
table({
'head': 'New Quotations', 'head': 'New Quotations',
'body': '%s' % result['new_quotations']['count'] 'body': '%s' % result['new_quotations'].get('count')
}), }),
'idx': 102 'idx': 102
}, },
'new_sales_orders': { 'new_sales_orders': {
'table': 'new_sales_orders' in result and table({ 'table': result.get('new_sales_orders') and \
table({
'head': 'New Sales Orders', 'head': 'New Sales Orders',
'body': '%s' % result['new_sales_orders']['count'] 'body': '%s' % result['new_sales_orders'].get('count')
}), }),
'idx': 103 'idx': 103
}, },
'new_purchase_orders': { 'new_purchase_orders': {
'table': 'new_purchase_orders' in result and table({ 'table': result.get('new_purchase_orders') and \
table({
'head': 'New Purchase Orders', 'head': 'New Purchase Orders',
'body': '%s' % result['new_purchase_orders']['count'] 'body': '%s' % result['new_purchase_orders'].get('count')
}), }),
'idx': 104 'idx': 104
}, },
'new_transactions': { 'new_transactions': {
'table': 'new_transactions' in result and table({ 'table': result.get('new_transactions') and \
table({
'head': 'New Transactions', 'head': 'New Transactions',
'body': '%s' % result['new_transactions']['count'] 'body': '%s' % result['new_transactions'].get('count')
}), }),
'idx': 105 'idx': 105
} }