Odoo Help

Welcome!

This community 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.

0

NotImplementedError: '__setitem__' not supported on frozendict

By
Harsh Dhaduk
on 1/12/15, 12:28 AM 3,844 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

 

0
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...

0
Yogesh
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
0
Anand
On 1/12/15, 12:43 AM

Hi..

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

Anand
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...

Anand
on 1/12/15, 2:05 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/12/15, 12:28 AM
Seen: 3844 times
Last updated: 7/1/16, 3:28 AM