summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/basic_model_tests.js
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-08-09 11:22:56 +0200
committerDavid Monjoie <dmo@odoo.com>2017-08-10 08:48:30 +0200
commit50957038b9ebe5e249da28a9745f957ad02a0760 (patch)
tree29835411cc9b02de2eb76a0015f4b2075aa9e6eb /addons/web/static/tests/views/basic_model_tests.js
parent0de067cae919937cfc5fa4cd3161d58f48d472b5 (diff)
[FIX] web: fix magic grouping on date fields
Date fields have magic grouping methods to specify how to group on them like date:month, date:weeks, date:days for example. It needs to be handled properly since date:month is not a valid field name but date is. Steps to reproduce the issue: - Go to Sales/Dashboard - Click on My Pipeline - Group by "Creation Month" Basically, this can be triggred from any view which has a search view which defines a group using the magic date grouping methods.
Diffstat (limited to 'addons/web/static/tests/views/basic_model_tests.js')
-rw-r--r--addons/web/static/tests/views/basic_model_tests.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/basic_model_tests.js b/addons/web/static/tests/views/basic_model_tests.js
index 53577d90e40..63214b0f2d7 100644
--- a/addons/web/static/tests/views/basic_model_tests.js
+++ b/addons/web/static/tests/views/basic_model_tests.js
@@ -956,6 +956,30 @@ QUnit.module('Views', {
model.destroy();
});
+ QUnit.test('group on date field with magic grouping method', function (assert) {
+ assert.expect(1);
+
+ this.params.fieldNames = ['foo'];
+ this.params.groupedBy = ['date:month'];
+ this.params.res_id = undefined;
+
+ var model = createModel({
+ Model: BasicModel,
+ data: this.data,
+ mockRPC: function (route, args) {
+ if (args.method === 'read_group') {
+ assert.deepEqual(args.kwargs.fields, ['foo', 'date'],
+ "should have correctly trimmed the magic grouping info from the field name");
+ }
+ return this._super.apply(this, arguments);
+ },
+ });
+
+ model.load(this.params);
+ model.destroy();
+ });
+
+
QUnit.test('read group when grouped by a selection field', function (assert) {
assert.expect(5);