diff options
| author | Thibault Delavallée <tde@odoo.com> | 2019-11-26 15:11:48 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-12-05 15:21:27 +0000 |
| commit | ca52dbaedeb8e0c930a2ea75fe4a38e46d90d19c (patch) | |
| tree | 1a7f46d743cc050759809b59cc182b931af56c2f | |
| parent | 8c6976a6344d9a5fe284b3df8e2bf89ceeb0595f (diff) | |
[IMP] base: add math floor and ceil to qweb rendering context
PURPOSE
As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.
SPECIFICATIONS
Add math floor and ceil functions in qweb rendering context. It allows to use
some math methods directly in templates to avoid unnecessary data preparation
in controllers that lead to a lot of hard to read code mixed with important
code. Notably in survey we will use them for some pagination within statistics
rendering.
LINKS
[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)
PR #40765
| -rw-r--r-- | odoo/addons/base/models/ir_ui_view.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py index 6ddcfe2acf6..d48ec33c546 100644 --- a/odoo/addons/base/models/ir_ui_view.py +++ b/odoo/addons/base/models/ir_ui_view.py @@ -8,6 +8,7 @@ import fnmatch import inspect import json import logging +import math import re import time import uuid @@ -1601,6 +1602,9 @@ actual arch. viewid=self.id, to_text=pycompat.to_text, image_data_uri=image_data_uri, + # specific 'math' functions to ease rounding in templates and lessen controller marshmalling + floor=math.floor, + ceil=math.ceil, ) return qcontext |
