From 3293496bbf63db6435f686d3c83cec4197c27bd6 Mon Sep 17 00:00:00 2001 From: asno-odoo Date: Mon, 30 Jan 2023 10:26:11 +0000 Subject: [PATCH] [FIX] l10n_fr_pos_cert: default timezone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When mocking views, if there is no timezone set in context and for user, providing Boolean value to pytz.timezone() functions results in error. It doesn't happen in UI as UI takes value from session timezone. closes odoo/odoo#112151 X-original-commit: 694de9d94de105336398a259c77d7e5bb0e42438 Signed-off-by: William André (wan) --- addons/l10n_fr_pos_cert/models/res_company.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_fr_pos_cert/models/res_company.py b/addons/l10n_fr_pos_cert/models/res_company.py index 30198c4eaaa..be5d0054c52 100644 --- a/addons/l10n_fr_pos_cert/models/res_company.py +++ b/addons/l10n_fr_pos_cert/models/res_company.py @@ -11,7 +11,7 @@ import pytz def ctx_tz(record, field): res_lang = None ctx = record._context - tz_name = pytz.timezone(ctx.get('tz') or record.env.user.tz) + tz_name = pytz.timezone(ctx.get('tz') or record.env.user.tz or 'UTC') timestamp = Datetime.from_string(record[field]) if ctx.get('lang'): res_lang = record.env['res.lang']._lang_get(ctx['lang'])