diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 8d3d74ee7fe..5a1e3e7eec8 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -1112,7 +1112,7 @@ var ListRenderer = BasicRenderer.extend({ this.$('table').append( $('') ); - this.$('table').append(this._renderOptionalColumnsDropdown()); + this.$el.append(this._renderOptionalColumnsDropdown()); } if (this.selection.length) { const $checked_rows = this.$('tr').filter( @@ -1284,6 +1284,13 @@ var ListRenderer = BasicRenderer.extend({ // default, which is why we need to toggle the dropdown manually. ev.stopPropagation(); this.$('.o_optional_columns .dropdown-toggle').dropdown('toggle'); + // Explicitly set left of the optional column dropdown as it is pushed inside + // this.$el, so we need to position it at the end of top right/left corner based + // on language direction. + var left = _t.database.parameters.direction === 'rtl' ? + this.$('.o_optional_columns .o_optional_columns_dropdown').width() : + this.$("table").width(); + this.$('.o_optional_columns').css("left", left); }, /** * Manages the keyboard events on the list. If the list is not editable, when the user navigates to diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index eabc0230626..f5c475889c3 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -10197,10 +10197,10 @@ QUnit.module('Views', { assert.containsOnce(list.$('table'), '.o_optional_columns_dropdown_toggle', "should have the optional columns dropdown toggle inside the table"); - const optionalFieldsToggler = list.el.querySelector('table').lastElementChild.previousSibling; + const optionalFieldsToggler = list.el.querySelector('table').lastElementChild; assert.ok(optionalFieldsToggler.classList.contains('o_optional_columns_dropdown_toggle'), 'The optional fields toggler is the second last element'); - const optionalFieldsDropdown = list.el.querySelector('table').lastElementChild; + const optionalFieldsDropdown = list.el.querySelector('.o_list_view').lastElementChild; assert.ok(optionalFieldsDropdown.classList.contains('o_optional_columns'), 'The optional fields dropdown is the last element'); @@ -10265,10 +10265,10 @@ QUnit.module('Views', { assert.containsOnce(list.$('table'), '.o_optional_columns_dropdown_toggle', "should have the optional columns dropdown toggle inside the table"); - const optionalFieldsToggler = list.el.querySelector('table').lastElementChild.previousSibling; + const optionalFieldsToggler = list.el.querySelector('table').lastElementChild; assert.ok(optionalFieldsToggler.classList.contains('o_optional_columns_dropdown_toggle'), 'The optional fields toggler is the last element'); - const optionalFieldsDropdown = list.el.querySelector('table').lastElementChild; + const optionalFieldsDropdown = list.el.querySelector('.o_list_view').lastElementChild; assert.ok(optionalFieldsDropdown.classList.contains('o_optional_columns'), 'The optional fields is the last element');