Odoo Help


Pass context in calling of super method.

Emipro Technologies Pvt. Ltd.
on 7/1/15, 10:33 AM 2,872 views

I want to pass context inside super method calling.

For ex.


def write(self, vals)

    ctx = self._context or {}


    res = super(product_product, self).with_context(ctx).write(vals) # It is going into infinite recursion.

#    res = super(product_product, self).write(vals).with_context(ctx) # It is not passing updated context to super method. 

    return res

Any one give proper way to pass context in super method call ?


Try with this context = self._context.copy() or {}

Solanki Shamji
on 8/14/15, 1:17 AM
On 8/14/15, 1:29 AM

Pass and get context value code:-

def write(self, values):
self = self.with_context(key='value')
res = super(product_product, self).write(values)
#print "Get Context value", self._context.get('key')
return res

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/1/15, 10:33 AM
Seen: 2872 times
Last updated: 4/12/16, 1:19 AM