summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/list_tests.js
diff options
context:
space:
mode:
authorMohammed Shekha <msh@odoo.com>2020-07-02 13:23:04 +0000
committerAaron Bohy <aab@odoo.com>2020-09-11 08:30:07 +0000
commit170cd2a0217c8d172115dee32e1e0e5e0451fc7a (patch)
treefc7e26d6e867bc220eb031a6aeff47069df970b6 /addons/web/static/tests/views/list_tests.js
parent5e5de2b2b64fd8cb259e72fc1a97dc754da871ad (diff)
[FIX] web: blank value in many2many_tags for multi_edit popup
Let's assume a list that is multi editable and contains a m2m field displayed with widget many2many_tags. Moreover, there are enough values in the comodel s.t. the 'Search More' option is available in the many2many_tags dropdown, and field 'display_name' isn't in the list view that opens in dialog. Enter multi-edition, edit the many2one field to add a value (click on 'Search More', and pick a value from the list): the picked value isn't correctly displayed in the confirmation dialog. The issue occurred because we didn't wait for the display_name to be fetched before opening the dialog. Task : 2150384 closes odoo/odoo#57481 X-original-commit: ccf5834045d8b4fff9af7ddf60814c3a640e8318 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Dhruv Patel <dhp@odoo.com>
Diffstat (limited to 'addons/web/static/tests/views/list_tests.js')
-rw-r--r--addons/web/static/tests/views/list_tests.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index 4d8cf86460e..2ea2e0396a9 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -7434,6 +7434,45 @@ QUnit.module('Views', {
list.destroy();
});
+ QUnit.test('multi edition: many2many_tags in many2many field', async function (assert) {
+ assert.expect(5);
+
+ for (let i = 4; i <= 10; i++) {
+ this.data.bar.records.push({ id: i, display_name: "Value" + i});
+ }
+
+ const list = await createView({
+ View: ListView,
+ model: 'foo',
+ data: this.data,
+ arch: '<tree multi_edit="1"><field name="m2m" widget="many2many_tags"/></tree>',
+ archs: {
+ 'bar,false,list': '<tree><field name="name"/></tree>',
+ 'bar,false,search': '<search></search>',
+ },
+ });
+
+ assert.containsN(list, '.o_list_record_selector input:enabled', 5);
+
+ // select two records and enter edit mode
+ await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_list_record_selector input'));
+ await testUtils.dom.click(list.$('.o_data_row:eq(1) .o_list_record_selector input'));
+ await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_data_cell'));
+
+ await testUtils.fields.many2one.clickOpenDropdown("m2m");
+ await testUtils.fields.many2one.clickItem("m2m", "Search More");
+ assert.containsOnce(document.body, '.modal .o_list_view', "should have open the modal");
+
+ await testUtils.dom.click($('.modal .o_list_view .o_data_row:first'));
+
+ assert.containsOnce(document.body, ".modal [role='alert']", "should have open the confirmation modal");
+ assert.containsN(document.body, ".modal .o_field_many2manytags .badge", 3);
+ assert.strictEqual($(".modal .o_field_many2manytags .badge:last").text().trim(), "Value 3",
+ "should have display_name in badge");
+
+ list.destroy();
+ });
+
QUnit.test('editable list view: multi edition of many2one: set same value', async function (assert) {
assert.expect(4);