summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorpka-odoo <pka@odoo.com>2020-05-04 09:07:20 +0000
committerAaron Bohy <aab@odoo.com>2020-05-04 14:31:11 +0000
commit067e8c88fe12a29fe8d87ba35a892f1c36a01e2e (patch)
tree1936db1b9ec34ecaaf207cf85e945033b77c64b4 /addons/web/static
parentc80fa71adbb2410b4ed5328f9093502969ff02bb (diff)
[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>
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/views/list/list_controller.js1
-rw-r--r--addons/web/static/tests/views/list_tests.js24
-rw-r--r--addons/web/static/tests/widgets/data_export_tests.js2
3 files changed, 25 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js
index 5dc5515173e..110fab8e897 100644
--- a/addons/web/static/src/js/views/list/list_controller.js
+++ b/addons/web/static/src/js/views/list/list_controller.js
@@ -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();
},
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index 985662cf27b..785b3864e8d 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -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);
diff --git a/addons/web/static/tests/widgets/data_export_tests.js b/addons/web/static/tests/widgets/data_export_tests.js
index 9a6f23b815b..e7fb9864791 100644
--- a/addons/web/static/tests/widgets/data_export_tests.js
+++ b/addons/web/static/tests/widgets/data_export_tests.js
@@ -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'));