From 4f1efa986d1aa8d8ea1bc6bde9c69d16eb72a91c Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 1 May 2012 17:10:32 +0530 Subject: [PATCH 1/6] [IMP] account : Improved the print overdue payment report. bzr revid: mdi@tinyerp.com-20120501114032-e2zp3umgw5ul918h --- addons/account/report/account_print_overdue.rml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 2c2b6f5954d..6dc53ae2819 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -92,6 +92,7 @@ + [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] Date @@ -153,22 +154,24 @@ - Dear Sir/Madam, + Dear Sir/Madam,[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] - [[ message(o, company) ]] + [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') or message(o, company) ]] + There is nothing due with this customer or a company. [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) != 0 and removeParentNode('blockTable') ]] - Best regards. + Best regards.[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] Date @@ -228,6 +231,7 @@ + [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] @@ -254,6 +258,7 @@ + [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] @@ -279,7 +284,7 @@ - Total amount due: [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]]. + Total amount due: [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') or formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]] From 593d14329f356c5c698cc1ed63ea536be297f851 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 1 May 2012 17:37:24 +0530 Subject: [PATCH 2/6] [IMP] account : Improved the message. bzr revid: mdi@tinyerp.com-20120501120724-16nho55vawhi5xus --- addons/account/report/account_print_overdue.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 6dc53ae2819..66b38950c79 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -162,7 +162,7 @@ [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') or message(o, company) ]] - There is nothing due with this customer or a company. [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) != 0 and removeParentNode('blockTable') ]] + There is nothing due with this customer or a company. [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) != 0 and removeParentNode('blockTable') ]] From afe6edf6c768cbefe883c9090cc569f87ad52e4b Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 3 May 2012 16:13:35 +0530 Subject: [PATCH 3/6] [IMP] account : Improved the print overdue payment report. bzr revid: mdi@tinyerp.com-20120503104335-qybllmlsjln5sv8h --- .../account/report/account_print_overdue.rml | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 66b38950c79..c3a4014c776 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -154,27 +154,26 @@ - Dear Sir/Madam,[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + Dear Sir/Madam,[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('para') ]] + [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('para') or message(o, company) ]] - [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') or message(o, company) ]] - There is nothing due with this customer or a company. [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) != 0 and removeParentNode('blockTable') ]] + There is nothing due with this customer or a company. [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) != 0 and removeParentNode('para') ]] - Best regards.[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + Best regards.[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('para') ]] - - [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + - Date + Date[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] Description @@ -201,7 +200,7 @@
[[repeatIn(getLines(o), 'line') ]] - + [[ formatLang(line['date'],date=True) ]] @@ -222,7 +221,7 @@ [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] - [[ time.strftime('%Y-%m-%d') > formatLang((line['date_maturity'])) and formatLang(line['debit'] - line['credit']) ]] [[ company.currency_id.symbol ]] + [[ time.strftime('%Y-%m-%d') > formatLang((line['date_maturity'])) and formatLang(line['debit'] - line['credit']) ]] [[ company.currency_id.symbol ]] [[ line['blocked'] and 'X' or '' ]] @@ -230,8 +229,7 @@
- - [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + @@ -239,7 +237,7 @@ - Sub-Total : + Sub-Total : [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] @@ -248,7 +246,7 @@ [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]] - [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)), currency_obj=company.currency_id) ]] + [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0))) ]] [[ company.currency_id.symbol ]] @@ -258,7 +256,6 @@ - [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] @@ -266,10 +263,10 @@ - Balance : + Balance : [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] - [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]] + [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] @@ -284,7 +281,7 @@ - Total amount due: [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') or formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]] + Total amount due: [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') or formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]]. From 790fc5d5df808b2ac80c168eb230537f16a3490e Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 3 May 2012 16:16:14 +0530 Subject: [PATCH 4/6] [IMP] account : Improved the print overdue payment report. bzr revid: mdi@tinyerp.com-20120503104614-6fbhnjqerhb0to0d --- addons/account/report/account_print_overdue.rml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index c3a4014c776..a8a44000719 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -92,7 +92,6 @@ - [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] Date From d8c903365d9fc03b0250686bdf70c003dba72079 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Fri, 4 May 2012 12:00:17 +0530 Subject: [PATCH 5/6] [IMP] account : Improved the print overdue payment report. bzr revid: mdi@tinyerp.com-20120504063017-nolj0oo3jr2yhdp6 --- addons/account/report/account_print_overdue.rml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index a8a44000719..0b10a0c8be4 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -153,26 +153,26 @@ - Dear Sir/Madam,[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('para') ]] + [[ not getLines(o) and removeParentNode('para') or 'Dear Sir/Madam,']] - [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('para') or message(o, company) ]] + [[ not getLines(o) and removeParentNode('para') or message(o, company) ]] - There is nothing due with this customer or a company. [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) != 0 and removeParentNode('para') ]] + [[ getLines(o) and removeParentNode('para') or 'There is nothing due with this customer.']] - Best regards.[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('para') ]] + [[ not getLines(o) and removeParentNode('para') or 'Best regards.']] - Date[[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + Date[[ not getLines(o) and removeParentNode('blockTable') ]] Description @@ -236,7 +236,7 @@ - Sub-Total : [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + [[ not getLines(o) and removeParentNode('blockTable') or 'Sub-Total :']] [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] @@ -262,7 +262,7 @@ - Balance : [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') ]] + [[ not getLines(o) and removeParentNode('blockTable') or 'Balance :']] [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] @@ -280,7 +280,7 @@ - Total amount due: [[ reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0) == 0 and removeParentNode('blockTable') or formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]]. + Total amount due: [[ not getLines(o) and removeParentNode('blockTable') or formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) ]]. From 8f99388391927735db36a6f29fe1f3e7fc9b4d91 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Fri, 4 May 2012 12:05:59 +0530 Subject: [PATCH 6/6] [IMP] account : Improve overdue message and set due date on invoice or current date accordingly. bzr revid: mdi@tinyerp.com-20120504063559-bl57pxfysn4850cd --- addons/account/account_invoice.py | 11 +++++++---- addons/account/company.py | 9 +++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index d06ba70bf02..d8014fbdb02 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -467,14 +467,17 @@ class account_invoice(osv.osv): return result def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice): - if not payment_term_id: - return {} res = {} - pt_obj = self.pool.get('account.payment.term') + if not payment_term_id: + if date_invoice: + res = {'value':{'date_due': date_invoice}} + else: + res = {'value':{'date_due': time.strftime('%Y-%m-%d')}} + return res if not date_invoice: date_invoice = time.strftime('%Y-%m-%d') - pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) + pterm_list = self.pool.get('account.payment.term').compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) if pterm_list: pterm_list = [line[0] for line in pterm_list] diff --git a/addons/account/company.py b/addons/account/company.py index e961fa563e4..8907f46c868 100644 --- a/addons/account/company.py +++ b/addons/account/company.py @@ -39,10 +39,11 @@ class res_company(osv.osv): _defaults = { 'expects_chart_of_accounts': True, - 'overdue_msg': '''Our records indicate that the following payments are still due. If the amount -has already been paid, please disregard this notice. However, if you have any -queries regarding your account, please contact us. -Thank you in advance. + 'overdue_msg': '''Our records indicate that the payments on you account are still due. Please find details below. + If the amount has already been paid,please disregard this notice. + Otherwise, please forward us the total amount stated below. + If you have any queries regarding your account, + Please contact us.Thank you in advance for your cooperation. ''' }