odoo 8 中的 browse() 方法

browse() method in odoo 8

在 OperERP 7 中,

有说法为

 context = dict(context or {})

 data = self.read(cr, uid, ids, [], context=context)[0]

在Odoo 8 中,我想用新的样式写这个语句。我试过下面的,但它不会工作。

 context = dict(self._context or {})

 data = self.browse([], context)[0]

这里如何传递上下文值?

您可以使用 with_context 更改当前环境的上下文。即

ctx = dict(self._context or {})
rec = self.with_context(ctx).browse()