[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)
This commit is contained in:
Thibault Delavallée
2020-07-31 15:34:37 +00:00
parent 4ac288b944
commit 45dcd18647
+11 -1
View File
@@ -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)