[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:
Denis Ledoux
2015-12-17 11:29:09 +01:00
parent c090d9992a
commit 2f4382f4b4
+1 -2
View File
@@ -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