diff options
| author | Adrien Dieudonne <adr@odoo.com> | 2018-07-06 14:22:58 +0200 |
|---|---|---|
| committer | Adrien Dieudonne <adr@odoo.com> | 2018-07-06 14:22:58 +0200 |
| commit | 3ebff1f4721dd4a9057db4d26162c57c8506700a (patch) | |
| tree | e3b02fcc528dcc3a0ae50b55a5d3a1d4708ab992 /addons/web/static/src/js/views/basic | |
| parent | f9a68d5e778da0ff4e1f1a0936b51b98a822a15a (diff) | |
| parent | 11b7857af63a35e81daa495bcb3522b3915f32ca (diff) | |
[MERGE] *: Easy date filters
This commit allow to create easily a range of periods (related to a field
of date or datetime type) to select in the filters menu.
Two new attributes on elements with tag 'filter' are now usable
in combination in a search view arch:
- date: string.
A valid field name with associated type date or datetime
- default_period: string (optional).
To choose in the following list:
- 'today'
- 'this_week'
- 'this_month' (default)
- 'this_quarter'
- 'this_year'
- 'yesterday'
- 'last_week'
- 'last_month'
- 'last_quarter'
- 'last_year'
- 'last_7_days'
- 'last_30_days'
- 'last_365_days'
Example:
<filter string="Creation Date" name="period_generator" date="create_date" default_period="this_quarter"/>
Note: the attribute 'domain' can not be used for such filters.
The generated domains are dynamic and can be saved as such
via the favorites menu.
task-10532
Diffstat (limited to 'addons/web/static/src/js/views/basic')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_view.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/js/views/basic/basic_view.js index 2c4ed711223..7bc5e95bfc8 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -15,7 +15,7 @@ var BasicController = require('web.BasicController'); var BasicModel = require('web.BasicModel'); var config = require('web.config'); var fieldRegistry = require('web.field_registry'); -var pyeval = require('web.pyeval'); +var pyUtils = require('web.py_utils'); var utils = require('web.utils'); var BasicView = AbstractView.extend({ @@ -216,13 +216,13 @@ var BasicView = AbstractView.extend({ attrs.decorations = attrs.decorations || []; attrs.decorations.push({ className: 'text-' + splitKey[1], - expression: py.parse(py.tokenize(value)) + expression: pyUtils._getPyJSAST(value), }); } }); if (!_.isObject(attrs.options)) { // parent arch could have already been processed (TODO this should not happen) - attrs.options = attrs.options ? pyeval.py_eval(attrs.options) : {}; + attrs.options = attrs.options ? pyUtils.py_eval(attrs.options) : {}; } if (attrs.on_change && !field.onChange) { |
