问题
In OperERP 7,
There is a statement as
context = dict(context or {})
data = self.read(cr, uid, ids, [], context=context)[0]
In Odoo 8, I want to write this statement in new style. I tried the below, but it wont work.
context = dict(self._context or {})
data = self.browse([], context)[0]
Here how do I pass the context value ?
回答1:
you can use with_context
to change current environment's context. i.e.
ctx = dict(self._context or {})
rec = self.with_context(ctx).browse()
来源:https://stackoverflow.com/questions/31602802/browse-method-in-odoo-8