From 7287c672f54126781854fea2412e50fbf9702bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 14 Mar 2018 12:04:46 +0100 Subject: [FIX] web: x2m: properly reset limit/offset to initial value When we discard an element, we want to make sure that the new state is not corrupted by previous user operations. In our case, we possibly had a limit and an offset values modified by the user. This could lead to unpleasant situations, with incorrect data displayed on the form view. Note that this actually fixes a new bug introduced by commit https://github.com/odoo/odoo/commit/e7fab234201e357da52c3576ad2e8fc9ceee9359 (this is the commit that introduces the tempLimitIncrement attribute) --- addons/web/static/src/js/views/basic/basic_model.js | 5 +++++ 1 file changed, 5 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 f081d0a6caa..949eb68cefc 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -359,6 +359,11 @@ var BasicModel = AbstractModel.extend({ elem._changes = null; elem._isDirty = false; } + elem.offset = 0; + if (elem.tempLimitIncrement) { + elem.limit -= elem.tempLimitIncrement; + delete elem.tempLimitIncrement; + } }); }, /** -- cgit v1.2.3