From 2f4382f4b4c60713e3ccc0afb57e20e9c23a4ef2 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 17 Dec 2015 11:26:11 +0100 Subject: [PATCH] [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 --- openerp/addons/base/ir/ir_qweb.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index c71ad97d313..d9d40776655 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -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