[FIX] base: compare lang code to the evaluation of the lang.
That will avoid to have the _logger.info at each print.
Now we fallback on lang of company and not en_US by default
If report lang was 'doc.partner_id.lang', we was looking for
lang code == 'doc.partner_id.lang'
instead of
code == eval('doc.partner_id.lang')
=> code == 'de_DE'.
This commit is contained in:
@@ -442,8 +442,9 @@ class QWeb(orm.AbstractModel):
|
||||
init_lang = d.context.get('lang', 'en_US')
|
||||
lang = template_attributes['lang']
|
||||
d.context['lang'] = self.eval(lang, d) or lang
|
||||
if not self.pool['res.lang'].search(d.cr, d.uid, [('code', '=', 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)
|
||||
if not self.pool['res.lang'].search(d.cr, d.uid, [('code', '=', d.context['lang'])], count=True, context=d.context):
|
||||
d.context['lang'] = qwebcontext.get('res_company') and qwebcontext.get('res_company').partner_id.lang or 'en_US'
|
||||
_logger.info("'%s' is not a valid language code, is an empty field or is not installed, falling back to %s" % (lang_eval, d.context['lang']))
|
||||
|
||||
d[0] = self.render_element(element, template_attributes, generated_attributes, d)
|
||||
cr = d.get('request') and d['request'].cr or None
|
||||
|
||||
Reference in New Issue
Block a user