diff options
| author | Robot Odoo <xmo+roboto@odoo.com> | 2018-11-06 12:51:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-06 12:51:37 +0100 |
| commit | e220721a8ee80c02fe5aba5ed8c9f3f4ae54ea97 (patch) | |
| tree | eb2d20161314d34c86b9e9744fbefde70f4e877e /addons/web/static/src | |
| parent | 764bd645fc1e6628fa743b498ae4c5cda25c9b3c (diff) | |
| parent | 6e9c1d92d7484c66735d9abc58e09b0e88fac57d (diff) | |
[FIX] web: accept field name as a groupby descriptor
In some cases, and for historical reasons, the groupby property can be
expressed as a string (for example, 'stage_id') instead of a list of
strings (for example, ['stage_id']).
However, the support was not complete. A crash could happen in some
cases. For example, if there is a group_by: 'stage_id' property in the
context of an action, it works in list view, but adding that view to the
dashboard would result in a crash, without this commit.
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
closes odoo/odoo#28408
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views/abstract_view.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/abstract_view.js b/addons/web/static/src/js/views/abstract_view.js index f3277d394a3..7fca3b83ff3 100644 --- a/addons/web/static/src/js/views/abstract_view.js +++ b/addons/web/static/src/js/views/abstract_view.js @@ -162,6 +162,11 @@ var AbstractView = Class.extend({ this.controllerParams.withControlPanel = params.withControlPanel; } + var groupBy = params.groupBy; + if (typeof groupBy === 'string') { + groupBy = [groupBy]; + } + this.loadParams = { context: params.context, count: params.count || ((this.controllerParams.ids !== undefined) && @@ -172,7 +177,7 @@ var AbstractView = Class.extend({ comparisonTimeRange: comparisonTimeRange, comparisonTimeRangeDescription: comparisonTimeRangeDescription, compare: compare, - groupedBy: params.groupBy, + groupedBy: groupBy, modelName: params.modelName, res_id: params.currentId, res_ids: params.ids, |
