Merge lp:~camptocamp/account-invoicing/account-invoicing_payment_term_rounding into lp:~account-core-editors/account-invoicing/7.0
Proposed by
Yannick Vaucher @ Camptocamp
Status: | Merged |
---|---|
Merged at revision: | 21 |
Proposed branch: | lp:~camptocamp/account-invoicing/account-invoicing_payment_term_rounding |
Merge into: | lp:~account-core-editors/account-invoicing/7.0 |
Diff against target: |
198 lines (+174/-0) 4 files modified
payment_term_rounding/__init__.py (+21/-0) payment_term_rounding/__openerp__.py (+34/-0) payment_term_rounding/account.py (+104/-0) payment_term_rounding/account_view.xml (+15/-0) |
To merge this branch: | bzr merge lp:~camptocamp/account-invoicing/account-invoicing_payment_term_rounding |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Frederic Clementi - Camptocamp (community) | Approve | ||
Guewen Baconnier @ Camptocamp | code review, no test | Approve | |
Review via email: mp+174949@code.launchpad.net |
Description of the change
Add module payment_
To post a comment you must log in.
s/rouding/rounding/ in __openerp__.py
In this code:
def compute_ line_amount( self, cr, uid, id, total_amount, remaining_amount, context=None):
if isinstance(id, list):
id = id[0]
I observed that tuple is usually an accepted type for the ids too.
When 'id' is a list, you should assert that the received length if 'id' is 1. Otherwise the programmer using your method might have unpredictable effects if he want to call it on multiple ids.
Proposal: line_amount( self, cr, uid, id, total_amount, remaining_amount, context=None): line_amount accepts only 1 ID"
def compute_
if isinstance(id, (tuple, list)):
assert len(id) == 1, "compute_
id = id[0]
When you format the dates, '%Y-%m-%d' should be replaced by openerp. tools.DEFAULT_ SERVER_ DATE_FORMAT
At l.157, the whole branch
if amt:
....
Can be replace by
if not amt:
continue
...
This will avoid to nest all this part of code and you'll gain some width.