diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-03-27 10:25:00 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-03-30 09:55:08 +0000 |
| commit | 7af5fb31ec7a3ef4bfce1756aa01824cba30e592 (patch) | |
| tree | 4aa270929c2b7bd48d7cd11865cfaadb18af1958 /addons/web/static/src/js/components | |
| parent | 9be9a75e67ac0727e2d5a0f7584f350f4ee638fb (diff) | |
[IMP] web: selection in list views
This commit allows the user to apply actions to all records
matching the current domain in list views. It also ensures that
the user is aware of the set of records actually selected.
The number of selected records is now displayed in the control
panel, and the user can, with an additional click, select all
records matching the current domain instead of the ones of the
current page.
Task 2185145
Diffstat (limited to 'addons/web/static/src/js/components')
| -rw-r--r-- | addons/web/static/src/js/components/action_menus.js | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/addons/web/static/src/js/components/action_menus.js b/addons/web/static/src/js/components/action_menus.js index 69a10423373..22e549a271e 100644 --- a/addons/web/static/src/js/components/action_menus.js +++ b/addons/web/static/src/js/components/action_menus.js @@ -3,7 +3,6 @@ odoo.define('web.ActionMenus', function (require) { const Context = require('web.Context'); const DropdownMenu = require('web.DropdownMenu'); - const pyUtils = require('web.py_utils'); const Registry = require('web.Registry'); const { Component } = owl; @@ -95,15 +94,25 @@ odoo.define('web.ActionMenus', function (require) { * @param {OwlEvent} ev */ async _executeAction(action) { + let activeIds = this.props.activeIds; + if (this.props.isDomainSelected) { + activeIds = await this.rpc({ + model: this.env.action.res_model, + method: 'search', + args: [this.props.domain], + kwargs: { + limit: this.env.session.active_ids_limit, + }, + }); + } const activeIdsContext = { - active_id: this.props.activeIds[0], - active_ids: this.props.activeIds, + active_id: activeIds[0], + active_ids: activeIds, active_model: this.env.action.res_model, - select_all: this.props.selectAll || false, + // keep active_domain in context for backward compatibility + // reasons, and to allow actions to bypass the active_ids_limit + active_domain: this.props.domain, }; - if (this.props.domain) { - activeIdsContext.active_domain = this.props.domain; - } const context = new Context(this.props.context, activeIdsContext).eval(); const result = await this.rpc({ @@ -149,9 +158,10 @@ odoo.define('web.ActionMenus', function (require) { ActionMenus.components = { DropdownMenu }; ActionMenus.props = { - activeIds: { type: Array, element: [Number|String] }, // virtual IDs are strings. + activeIds: { type: Array, element: [Number | String] }, // virtual IDs are strings. context: Object, domain: { type: Array, optional: 1 }, + isDomainSelected: { type: Boolean, optional: 1 }, items: { type: Object, shape: { @@ -160,7 +170,6 @@ odoo.define('web.ActionMenus', function (require) { other: { type: Array, optional: 1 }, }, }, - selectAll: { type: Boolean, optional: 1 }, }; ActionMenus.template = 'web.ActionMenus'; |
