[IMP] base: allow 'render' override with new api
New API use a frozendict for context, so when a function in the call chain is overrided by new API (eg: render function of ir.qweb) the code now changed by this commit would cause an error. Instead this code duplicate the context frozendict as a dict removing the need to set back the intial language in the context. opw-681167 note: no need for >=saas-11
This commit is contained in:
@@ -439,9 +439,8 @@ class QWeb(orm.AbstractModel):
|
||||
d = qwebcontext.copy()
|
||||
|
||||
if 'lang' in template_attributes:
|
||||
init_lang = d.context.get('lang', 'en_US')
|
||||
lang = template_attributes['lang']
|
||||
d.context['lang'] = self.eval(lang, d) or lang
|
||||
d.context = dict(d.context, lang=self.eval(lang, d) or lang)
|
||||
if not self.pool['res.lang'].search(d.cr, d.uid, [('code', '=', d.context['lang'])], count=True, context=d.context):
|
||||
_logger.info("'%s' is not a valid language code, is an empty field or is not installed, falling back to en_US", lang)
|
||||
|
||||
@@ -458,10 +457,6 @@ class QWeb(orm.AbstractModel):
|
||||
d['generated_attributes'] = generated_attributes
|
||||
res = self.render(cr, uid, template, d)
|
||||
|
||||
# we need to reset the lang after the rendering
|
||||
if 'lang' in template_attributes:
|
||||
d.context['lang'] = init_lang
|
||||
|
||||
return res
|
||||
|
||||
def render_tag_call_assets(self, element, template_attributes, generated_attributes, qwebcontext):
|
||||
|
||||
Reference in New Issue
Block a user