Jay Venkat
Jay Venkat

Reputation: 397

browse() method in odoo 8

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 ?

Upvotes: 1

Views: 743

Answers (1)

Atul Arvind
Atul Arvind

Reputation: 16743

you can use with_context to change current environment's context. i.e.

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

Upvotes: 1

Related Questions