From 3ea17f597b60dd32a62b919cabc8ee7b44568267 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Thu, 1 Jul 2021 09:17:27 +0000 Subject: [PATCH] [FIX] translate: get class attribute safely 58d3b670221b3 was not correctly forward ported, it misses the `''` fallback part of the original commit dc20ab9c02c9 Without this, traceback is shown. Step to reproduce: - Open HTML Editor (or edit a backend view) - Add an input with no class but a value attribute (no type or type text) closes odoo/odoo#73057 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 baf5f17ac15..3f68da25b1b 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.get('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()}, )