[FIX] ir_qweb: translatable fields
This revision is related to 5257721
`record._columns` doesn't contain all record fields,
computed non-stored fields are not included in `_columns`,
Therefore, when a computed non-stored field was used in the QWeb xml,
this crashed with a Keyerror exception.
Using `_fields` solves this issue. Nevertheless, translate
is not always set, but is set when the fields is indeed translatable,
so the use of `getattr` was required.
opw-660072
This commit is contained in:
@@ -634,8 +634,7 @@ class FieldConverter(osv.AbstractModel):
|
||||
inherit_branding = context and context.get('inherit_branding')
|
||||
if not inherit_branding and context and context.get('inherit_branding_auto'):
|
||||
inherit_branding = self.pool['ir.model.access'].check(cr, uid, record._name, 'write', False, context=context)
|
||||
|
||||
translate = context and context.get('edit_translations') and context.get('translatable') and record._columns[field_name].translate
|
||||
translate = context and context.get('edit_translations') and context.get('translatable') and getattr(record._fields[field_name], 'translate', False)
|
||||
|
||||
if inherit_branding or translate:
|
||||
# add branding attributes
|
||||
|
||||
Reference in New Issue
Block a user