I had heard somewhere that one of the features planned for the orm in v8 was that you wouldn't need to pass cursor and user id with every call to a model's method, i.e:
self.pool.get('some.model').browse(cr, uid, id_list) # Old way
self.pool.get('some.model').browse(id_list) # New way.
Assuming that this is still going to be implemented (maybe it has been already?) I would like to make sure it works in all contexts. Specifically, I am making custom http-endpoints as part of a module. At least in the v7 way of doing things, I find models from request.registry instead of self.pool. If I call model methods in this way:
request.registry.get('some.model').browse(id_list)
will it work?
I am currently developing on a pull from the master branch of Odoo from 2014-08-05, and calling browse() with just a list of id's throws a TypeError (expects at least 3 arguments). Can I expect the new way to work in future (or am I maybe doing it wrong)?
I don't have enough Karma to comment Dhinesh's post so I'll put this here for now: If I try to use Env I get a NameError (global name 'Env' is not defined). Where can I import it from?
All new v8 features are in [from openerp import api] or for environment use [from openerp.api import Environment] You can use it from self itself like cr, uid, context = self.env.args. For more info check addons/account/partner.py -> @api.v8 def map_tax(self, taxes):
Thank you very much: helpful and very fast.