diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-08-27 16:44:17 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-08-27 16:44:17 +0200 |
| commit | 9947133361f4d6fc4c9cbb68e2e2230728fcdafd (patch) | |
| tree | 4fc266cd52f55d94f86d7df2ab75323e35fde99c /addons/web/static/tests/helpers/mock_server.js | |
| parent | f7ead5fd50f4b6db2a1d4c947fc4e15dceedbbd7 (diff) | |
| parent | 40430699dfbba715b143c109ebae415074da9f40 (diff) | |
[MERGE] forward port branch saas-11.5 up to 40430699dfb
Diffstat (limited to 'addons/web/static/tests/helpers/mock_server.js')
| -rw-r--r-- | addons/web/static/tests/helpers/mock_server.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/addons/web/static/tests/helpers/mock_server.js b/addons/web/static/tests/helpers/mock_server.js index 6839223a903..f05c89c1a7d 100644 --- a/addons/web/static/tests/helpers/mock_server.js +++ b/addons/web/static/tests/helpers/mock_server.js @@ -882,6 +882,23 @@ var MockServer = Class.extend({ return data; }, /** + * Simulates a 'resequence' operation + * + * @private + * @param {string} model + * @param {string} field + * @param {Array} ids + */ + _mockResequence: function (args) { + var offset = args.offset ? Number(args.offset) : 0; + var field = args.field ? args.field : 'sequence'; + var records = this.data[args.model].records; + for (var i in args.ids) { + var record = _.findWhere(this.data[args.model].records, {id: args.ids[i]}); + record[field] = Number(i) + offset; + } + }, + /** * Simulate a 'search_count' operation * * @private @@ -1040,7 +1057,7 @@ var MockServer = Class.extend({ return $.when(this._mockSearchReadController(args)); case '/web/dataset/resequence': - return $.when(); + return $.when(this._mockResequence(args)); } if (route.indexOf('/web/image') >= 0 || _.contains(['.png', '.jpg'], route.substr(route.length - 4))) { return $.when(); |
