Merge lp:~openerp-community/openobject-addons/lpistone_6.0_lp784499 into lp:openobject-addons/6.0
Proposed by
Leonardo Pistone
Status: | Merged |
---|---|
Merged at revision: | 4617 |
Proposed branch: | lp:~openerp-community/openobject-addons/lpistone_6.0_lp784499 |
Merge into: | lp:openobject-addons/6.0 |
Diff against target: |
18 lines (+5/-3) 1 file modified
account_invoice_layout/account_invoice_layout.py (+5/-3) |
To merge this branch: | bzr merge lp:~openerp-community/openobject-addons/lpistone_6.0_lp784499 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jay Vora (Serpent Consulting Services) (community) | Approve | ||
Leonardo Pistone (community) | Approve | ||
Olivier Dony (Odoo) | Needs Fixing | ||
Review via email: mp+61377@code.launchpad.net |
To post a comment you must log in.
Hi Leonardo,
Thanks for the bug report and the merge proposal!
There is one thing that could be improved in your patch: instead of using a direct SQL query and having to manually filter on the company, it would be much better to rely on the use of ORM methods, which do perform the appropriate filtering (due to the record rules defined in ir.rules).
This way you don't hardcode the filtering, and you also avoid bypassing the ORM, which is not recommended.
If the initial code had done the same, there would have been no bug, so let's use this opportunity to improve it :-)
E.g: get('account. account' ).search( cr, uid,[('parent_id', '=', False)], context=context, limit=1)
account_ids = self.pool.
return account_ids[0] if account_ids else False