summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_template.py
diff options
context:
space:
mode:
authorjem-odoo <jem@openerp.com>2019-06-19 13:27:47 +0000
committerjem-odoo <jem@openerp.com>2019-06-28 06:51:17 +0000
commit2cbbc88dabcbe11baca2f3e30ec7425af39141e4 (patch)
tree07c4d8cc8c5429f7810db18a665c3c5e3d5aa836 /addons/mail/models/mail_template.py
parentef7871826edce400884fe032366781f59aafd8a6 (diff)
[IMP] tools: introduces format_duration
As some formatting tools already exists, it is time for float_time conversion to have its own. Purpose is to extract formatting logic from the float_time qweb widget to tools, in order to reuse it in mail.template (jinja). We named it 'format_duration', to follow babel convention. This can bring confusion with the duration qweb widget, but this widget should be called 'timedelta', as it is more generic than this one. Task-2025396 closes odoo/odoo#34417 Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
Diffstat (limited to 'addons/mail/models/mail_template.py')
-rw-r--r--addons/mail/models/mail_template.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py
index 3edfbe28e66..d92a8a5ecb0 100644
--- a/addons/mail/models/mail_template.py
+++ b/addons/mail/models/mail_template.py
@@ -281,6 +281,7 @@ class MailTemplate(models.Model):
'format_date': lambda date, date_format=False, lang_code=False: format_date(self.env, date, date_format, lang_code),
'format_datetime': lambda dt, tz=False, dt_format=False, lang_code=False: format_datetime(self.env, dt, tz, dt_format, lang_code),
'format_amount': lambda amount, currency, lang_code=False: tools.format_amount(self.env, amount, currency, lang_code),
+ 'format_duration': lambda value: tools.format_duration(value),
'user': self.env.user,
'ctx': self._context, # context kw would clash with mako internals
}