[IMP] web: hide export button when selected records

Part of task 2234547

Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
This commit is contained in:
pka-odoo
2020-05-04 14:31:11 +00:00
committed by Aaron Bohy
co-authored by Mohammed Shekha Aaron Bohy
parent c80fa71adb
commit 067e8c88fe
3 changed files with 25 additions and 2 deletions
@@ -812,6 +812,7 @@ var ListController = BasicController.extend({
this.selectedRecords = ev.data.selection;
this.isPageSelected = ev.data.allChecked;
this.isDomainSelected = false;
this.$('.o_list_export_xlsx').toggle(!this.selectedRecords.length);
this._updateSelectionBox();
this._updateControlPanel();
},
@@ -253,6 +253,30 @@ QUnit.module('Views', {
list.destroy();
});
QUnit.test('export button in list view', async function (assert) {
assert.expect(5);
const list = await createView({
View: ListView,
model: 'foo',
data: this.data,
arch: '<tree><field name="foo"/></tree>',
});
assert.containsN(list, '.o_data_row', 4);
assert.isVisible(list.$('.o_list_export_xlsx'));
await testUtils.dom.click(list.$('tbody td.o_list_record_selector:first input'));
assert.isNotVisible(list.$('.o_list_export_xlsx'));
assert.containsOnce(list.$('.o_cp_buttons'), '.o_list_selection_box');
await testUtils.dom.click(list.$('tbody td.o_list_record_selector:first input'));
assert.isVisible(list.$('.o_list_export_xlsx'));
list.destroy();
});
QUnit.test('simple editable rendering', async function (assert) {
assert.expect(15);
@@ -325,8 +325,6 @@ QUnit.module('widgets', {
},
});
// select a record => should not be taken into account
await testUtils.dom.click(list.$('.o_data_row .o_list_record_selector input')[0]);
// Download
await testUtils.dom.click(list.$buttons.find('.o_list_export_xlsx'));