[FIX] l10n_fr_pos_cert: default timezone

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) <wan@odoo.com>
This commit is contained in:
asno-odoo
2023-02-07 23:16:52 +01:00
parent 329fc12c89
commit 3293496bbf
@@ -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'])