Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using with_context in super call turns into infinite call in odoo

In odoo context dictionary is frozen so no one can update it, for that one solution is also available is calling method using with_context.

ctx = self.env.context.copy()
ctx.update({'additional_parameter' : value})
self.with_context(ctx).methodname()

but when we use the same pattern to call super method then result turns into the infinite call.

ctx = self.env.context.copy()
ctx.update({'additional_parameter' : value})
super(product_product, self).with_context(ctx).create(vals)

Any help will be highly appreciated.

like image 890
Emipro Technologies Pvt. Ltd. Avatar asked Jul 02 '15 07:07

Emipro Technologies Pvt. Ltd.


1 Answers

I think you should try something like this at respective line:

super(product_product, self.with_context(ctx)).create(vals)
like image 64
Vipul Bhatt Avatar answered Nov 14 '22 12:11

Vipul Bhatt