From 61216f116ac5c6e144c693b15408ad13db9f7ed4 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 14 Mar 2018 14:36:57 +0100 Subject: [FIX] web: add many records in m2m list Have a model with a m2m (field A) this m2m has also a m2m (and displayed as m2m tags in the view) (field AA) Have a domain on field A, to trigger the search view selection Click on add an item Select everything in the modal, making sure that there is more than 40 records Click on Select Before this commit: There was a traceback indicating the local data did not contain records >= 40 This was because the internal data repository was constrained by a limit After this commit: We adapt the limit of the local data repository and there is not traceback OPW 1823400 --- addons/web/static/src/js/views/basic/basic_model.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 949eb68cefc..e60e3f15a03 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1646,6 +1646,12 @@ var BasicModel = AbstractModel.extend({ // handle multiple add: command[2] may be a dict of values (1 // record added) or an array of dict of values var data = _.isArray(command.ids) ? command.ids : [command.ids]; + + // Ensure the local data repository (list) boundaries can handle incoming records (data) + if (data.length + list.res_ids.length > list.limit) { + list.limit = data.length + list.res_ids.length; + } + var list_records = {}; _.each(data, function (d) { rec = self._makeDataPoint({ -- cgit v1.2.3