Odoo Help


NotImplementedError: '__setitem__' not supported on frozendict

Harsh Dhaduk
on 1/12/15, 12:28 AM 6,063 views

Hi friends,

I tried to update context in Odoo8 API i got below error and i also try to update self.with_context but it not display when i print self._context.

So i want to know what is difference between self.with_context and self._context?

Any have solution for below error?

File "/home/workspace/erp/openerp/addon/training/registration.py", line 106, in action_open_survey
    self._context['survey_token'] = response_id.token
  File "/home/workspace/erp/openerp/tools/misc.py", line 1250, in __setitem__
    raise NotImplementedError("'__setitem__' not supported on frozendict")
NotImplementedError: '__setitem__' not supported on frozendict


Thanks in advance


Dilip Dabhi
On 7/1/16, 3:28 AM

you can try this : 

new_context = dict(self.env.context).copy()

new_context.update( { 'Key' : Value } )

and pass new_context in function...




| 4 3 8
Delhi, India

Nothing to say .... :)

On 9/2/15, 9:42 PM

in case of that error you can update context like:

dict(context).update({'key' : value})

That doesn't work. The change doesn't show up in the dict but the error message neither.

Andreas Maertens
on 1/29/16, 3:13 AM

Are you sure that this doesnt work? context=dict(context) context.update({'key' :value}) before using context in a function.

Cyrus Waithaka
on 2/26/16, 6:18 AM
On 1/12/15, 12:43 AM


in odoo-7 i used to add in xml file like this..

<field name="pricelist_id"  context="{'prod_id': product_id,'c_id':id}" options='{"always_reload": True}' on_change="onchange_price(product_id,pricelist_id)" />

it works good.....

Thanks for your answer anand :) can you please explain in brief? Ans i am using odoo8 api to update context in .py file not in xml because of business login.

Harsh Dhaduk
on 1/12/15, 12:53 AM

have u seen this.. https://www.odoo.com/forum/help-1/question/whats-the-context-2236

on 1/12/15, 1:01 AM

Hi anand, i seen that one i tried that one but still i got error msg.

Harsh Dhaduk
on 1/12/15, 1:22 AM

post the code which throws error...

on 1/12/15, 2:05 AM

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: 1/12/15, 12:28 AM
Seen: 6063 times
Last updated: 7/1/16, 3:28 AM