From 45dcd186477e07cc2ca5b051958ddc30078f91b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 27 Jul 2020 15:04:27 +0000 Subject: [PATCH] [IMP] website: support add_direction in duration qweb widget RATIONALE Events are sometimes held online, gathering a community. In this merge we improve Event application to better support full-online events with improved tracks, wishlists, chat rooms, ... PURPOSE Prepare Event Online support by providing fixes in registration and event frontend flows. Also provide a quick back2basic in backend views to prepare addition of Online sub modules. SPECIFICATIONS Allow to give add_direction to duration widget, propagated to babel formatting. See babel for any information about its use. LINKS Community PR odoo/odoo#55197 Enterprise PR odoo/enterprise#12113 Task ID-2309702 (Event Preparatory Merge 4) Prepares Task ID-2252655 (Main Online Event task) --- odoo/addons/base/models/ir_qweb_fields.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_qweb_fields.py b/odoo/addons/base/models/ir_qweb_fields.py index 3caa5c665aa..da6d9f86390 100644 --- a/odoo/addons/base/models/ir_qweb_fields.py +++ b/odoo/addons/base/models/ir_qweb_fields.py @@ -528,6 +528,11 @@ class DurationConverter(models.AbstractModel): description=_("Formatting: long, short, narrow (not used for digital)"), default_value='long' ), + add_direction=dict( + type="boolean", + string=_("Add direction"), + description=_("Add directional information (not used for digital)") + ), ) return options @@ -566,7 +571,12 @@ class DurationConverter(models.AbstractModel): if not v: continue section = babel.dates.format_timedelta( - v*secs_per_unit, format=options.get('format', 'long'), threshold=1, locale=locale) + v*secs_per_unit, + granularity=round_to, + add_direction=options.get('add_direction'), + format=options.get('format', 'long'), + threshold=1, + locale=locale) if section: sections.append(section)