diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-07-27 15:04:27 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-07-31 15:34:37 +0000 |
| commit | 45dcd186477e07cc2ca5b051958ddc30078f91b5 (patch) | |
| tree | 69d41e2c6f54155e4848a3f39956f361f7ece097 | |
| parent | 4ac288b9444229729f01f1ec7c14121fbd2bab0f (diff) | |
[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)
| -rw-r--r-- | odoo/addons/base/models/ir_qweb_fields.py | 12 |
1 files changed, 11 insertions, 1 deletions
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) |
