在odoo 8中的browser()方法 [英] browse() method in odoo 8
本文介绍了在odoo 8中的browser()方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在OperERP 7中,
In OperERP 7,
有一个声明为
context = dict(context or {})
data = self.read(cr, uid, ids, [], context=context)[0]
在Odoo 8中,我想以新样式编写此语句.我尝试了以下方法,但无法正常工作.
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 ?
推荐答案
,您可以使用with_context
更改当前环境的上下文.即
you can use with_context
to change current environment's context. i.e.
ctx = dict(self._context or {})
rec = self.with_context(ctx).browse()
这篇关于在odoo 8中的browser()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文