Olivier, to be confirmed, but I think company_id=%d is still required;
in case of an hierarchy of companies as I suppose the rule uses child_of
instead of =

Olivier Dony (OpenERP) wrote:
> Review: Needs Fixing
> 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:
>   account_ids = self.pool.get('account.account').search(cr, 
> uid,[('parent_id', '=', False)], context=context, limit=1)
>   return account_ids[0] if account_ids else False


-- 
Fabien Pinckaers
CEO OpenERP
Chaussée de Namur 40
B-1367 Grand-Rosière
Belgium
Phone: +32.81.81.37.00
Fax: +32.81.73.35.01
Web: http://openerp.com

https://code.launchpad.net/~openerp-community/openobject-addons/lpistone_6.0_lp784499/+merge/61377
Your team OpenERP Community is subscribed to branch 
lp:~openerp-community/openobject-addons/lpistone_6.0_lp784499.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp

Reply via email to