From 09a9c48180216b70233af16e5b1a6d375ceec69a Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 20 Jun 2019 10:56:54 +0000 Subject: [PATCH] [FIX] web: resequence after draft (re-enable test) When e61639723d was forward-ported, there was an adapatation in 12.3 version with bbc8c9fc2 so the test pass (because of another issue where if a line is moved after the draft line, the code tried to discard the moved line and not the draft line). The same adaptation is necessary in saas-12.4 but since the code changed amply, the test was temporarily just skipped (in 83d0eaedc7). With this changeset, the adaptation is forward-ported from saas-12.3 to saas-12.4 and the test is re-enabled. opw-1966589 closes #34277 Signed-off-by: Nicolas Lempereur (nle) --- .../web/static/src/js/views/list/list_editable_renderer.js | 5 +++++ addons/web/static/tests/views/form_tests.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js index a6615cbf38c..6469b78347a 100644 --- a/addons/web/static/src/js/views/list/list_editable_renderer.js +++ b/addons/web/static/src/js/views/list/list_editable_renderer.js @@ -795,6 +795,11 @@ ListRenderer.include({ helper: 'clone', handle: '.o_row_handle', stop: function (event, ui) { + // update currentID taking moved line into account + if (self.currentRow !== null) { + var currentID = self.state.data[self.currentRow].id; + self.currentRow = self._getRow(currentID).index(); + } self.unselectRow().then(function () { self._moveRecord(ui.item.data('id'), ui.item.index()); }); diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index aaa1b1cb3aa..7c6b0c5c335 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -8159,7 +8159,7 @@ QUnit.module('Views', { form.destroy(); }); - QUnit.skip('resequence list lines when discardable lines are present', async function (assert) { + QUnit.test('resequence list lines when discardable lines are present', async function (assert) { assert.expect(8); var onchangeNum = 0;