From dc20ab9c02c927ff44f9d3eadfb8cc6b794398af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Mottet=20=28oms=29?= Date: Thu, 24 Jun 2021 14:33:39 +0000 Subject: [PATCH] [FW][FIX] translate: get class attribute safely The 'class' attribute was not safely accessed using get. Since this attribute is not always present the condition evaluation failed in some cases. task-2276724 closes odoo/odoo#72894 X-original-commit: 58d3b670221b37c5c4c67ee53fbc545f6fb70395 Signed-off-by: Thibault Delavallee (tde) --- odoo/tools/translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index 18b90fd38bc..baf5f17ac15 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -152,7 +152,7 @@ TRANSLATED_ATTRS = dict.fromkeys({ 'value_label', }, lambda e: True) TRANSLATED_ATTRS.update( - value=lambda e: (e.tag == 'input' and e.attrib.get('type', 'text') == 'text') and 'datetimepicker-input' not in e.attrib['class'].split(' '), + value=lambda e: (e.tag == 'input' and e.attrib.get('type', 'text') == 'text') and 'datetimepicker-input' not in e.attrib.get('class').split(' '), text=lambda e: (e.tag == 'field' and e.attrib.get('widget', '') == 'url'), **{f't-attf-{attr}': cond for attr, cond in TRANSLATED_ATTRS.items()}, )