[IMP]Docx Report Generation : new filter duration for float_time

This commit is contained in:
Fabien BOURGEOIS 2025-02-21 09:01:41 +01:00
parent 0df7af86e1
commit 8c5e3dbb7d
2 changed files with 3 additions and 2 deletions

View File

@ -14,7 +14,7 @@
"author": "RYDLAB, Yaltik", "author": "RYDLAB, Yaltik",
"website": "https://rydlab.ru", "website": "https://rydlab.ru",
"category": "Technical", "category": "Technical",
"version": "16.0.2.2.5", "version": "16.0.2.2.6",
"license": "LGPL-3", "license": "LGPL-3",
"depends": ["base", "web", "custom_report_field", "report_monetary_helpers"], "depends": ["base", "web", "custom_report_field", "report_monetary_helpers"],
"external_dependencies": {"python": ["docxcompose", "docxtpl", "beautifulsoup4"]}, "external_dependencies": {"python": ["docxcompose", "docxtpl", "beautifulsoup4"]},

View File

@ -25,7 +25,7 @@ from odoo import _, api, fields, models
from odoo.exceptions import AccessError, UserError from odoo.exceptions import AccessError, UserError
from odoo.http import request from odoo.http import request
from odoo.tools.safe_eval import safe_eval, time from odoo.tools.safe_eval import safe_eval, time
from odoo.tools.misc import format_date, format_datetime from odoo.tools.misc import format_date, format_datetime, format_duration
try: try:
from odoo.addons.gotenberg.service.utils import ( from odoo.addons.gotenberg.service.utils import (
@ -540,6 +540,7 @@ class IrActionsReport(models.Model):
jinja_env.filters['datetimefmt'] = lambda dt, df=False: ( jinja_env.filters['datetimefmt'] = lambda dt, df=False: (
format_datetime(self.env, dt, dt_format=df) format_datetime(self.env, dt, dt_format=df)
) )
jinja_env.filters['duration'] = lambda du: format_duration(du)
jinja_env.filters['localesel'] = lambda record, field: ( jinja_env.filters['localesel'] = lambda record, field: (
record._fields[field].convert_to_export(getattr(record, field), self) record._fields[field].convert_to_export(getattr(record, field), self)
) )