From d12813f7eec9d71be7573bf1dcaba9f8cf67eb79 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 23 Jun 2020 11:41:04 +0000 Subject: [PATCH] [IMP] tools: fallback on empty translation Avoid returning False if, for any reason, the return is falsy (False, None,...) Following the discussion in odoo/odoo#53254, the root cause was a call in the form _(foo) where foo was equal False While nothing else than a string should be the argument of _, it's still technically possible to pass something else and get a bad return value. Fallback on empty string to be consistent. --- 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 e98ad4e9b7a..b2bf929ec18 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -487,7 +487,7 @@ class GettextAlias(object): finally: if cr and is_new_cr: cr.close() - return res + return res or '' @functools.total_ordering