[FIX] web: render buttons after list selection box
With this commit we display list selection box after all list header buttons, previously buttons were displayed before header buttons. task-2628038 closes odoo/odoo#78057 X-original-commit: 09c5e178c61feb69d6fd27e4bb9df979fa480f41 Signed-off-by: FrancoisGe <fge@odoo.com>
This commit is contained in:
@@ -659,6 +659,7 @@ var ListController = BasicController.extend({
|
||||
* @private
|
||||
*/
|
||||
_updateSelectionBox() {
|
||||
this._renderHeaderButtons();
|
||||
if (this.$selectionBox) {
|
||||
this.$selectionBox.remove();
|
||||
this.$selectionBox = null;
|
||||
@@ -674,7 +675,6 @@ var ListController = BasicController.extend({
|
||||
}));
|
||||
this.$selectionBox.appendTo(this.$buttons);
|
||||
}
|
||||
this._renderHeaderButtons();
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -557,7 +557,7 @@ QUnit.module('Views', {
|
||||
assert.hasClass(cpButtons[0].querySelector('button[name="x"]'), 'btn btn-secondary');
|
||||
assert.containsOnce(cpButtons[0], '.o_list_selection_box');
|
||||
assert.strictEqual(
|
||||
cpButtons[0].querySelector('button[name="x"]').previousElementSibling,
|
||||
cpButtons[0].querySelector('button[name="x"]').nextElementSibling,
|
||||
cpButtons[0].querySelector('.o_list_selection_box')
|
||||
);
|
||||
assert.containsNone(cpButtons[0], 'button[name="y"]');
|
||||
@@ -2234,6 +2234,38 @@ QUnit.module('Views', {
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('selection box is displayed after header buttons', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const list = await createView({
|
||||
View: ListView,
|
||||
model: 'foo',
|
||||
data: this.data,
|
||||
arch:
|
||||
`<tree>
|
||||
<header>
|
||||
<button name="x" type="object" class="plaf" string="plaf"/>
|
||||
<button name="y" type="object" class="plouf" string="plouf"/>
|
||||
</header>
|
||||
<field name="foo"/>
|
||||
<field name="bar"/>
|
||||
</tree>`,
|
||||
});
|
||||
|
||||
assert.containsN(list, '.o_data_row', 4);
|
||||
assert.containsNone(list.$('.o_cp_buttons'), '.o_list_selection_box');
|
||||
|
||||
// select a record
|
||||
await testUtils.dom.click(list.$('.o_data_row:first .o_list_record_selector input'));
|
||||
assert.containsOnce(list.$('.o_cp_buttons'), '.o_list_selection_box');
|
||||
const lastElement = list.$('.o_cp_buttons .o_list_buttons').children(":last")[0];
|
||||
assert.strictEqual(lastElement, list.$('.o_cp_buttons .o_list_selection_box')[0],
|
||||
"last element should selection box");
|
||||
assert.strictEqual(list.$('.o_list_selection_box').text().trim(), '1 selected');
|
||||
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('selection box is removed after multi record edition', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user