Search code examples
odooodoo-9odoo-10

Update Context in Odoo Controller (request.env.context)


I want to update request context,

request.env.context

At the moment I got this dictionary

{'lang': u'en_US', 'tz': False, 'uid': 21}

I wanna update lang key, and expected output of

request.env.context
{'lang': 'de_DE', 'tz': False, 'uid': 21}

Any idea how.


Solution

  • context = request.env.context.copy()
    context.update({'lang': u'en_CA'})
    request.env.context = context