summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorMohammed Shekha <msh@odoo.com>2020-12-21 08:54:35 +0000
committerMohammed Shekha <msh@odoo.com>2021-01-05 11:26:42 +0000
commit2ddb8e07ab9fcce3427266247069de8546a87fb5 (patch)
treea95b9d65d410c2f405df37b58b0b66c4217119d2 /addons/web/static/tests
parenta14c74d926b35dc499914edcbb7b93e638fe3bce (diff)
[FIX] web: list: keep line when click in m2o dropdown
Before this commit, in editable list views with a many2one, when the user clicked inside the many2one dropdown, in the padding above the first item or below the last item, the dropdown closed itself and the row was removed (if it wasn't dirty yet). This commit fixes that issue by ignoring clicks at those specific spots. Task 2377864 closes odoo/odoo#63993 X-original-commit: dd40745dfdc98e82142e64ca58c0c976f6ad8d97 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/views/list_tests.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index fa0782c8c1c..8c0348c7e5c 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -2863,6 +2863,30 @@ QUnit.module('Views', {
form.destroy();
});
+ QUnit.test('editable list view, click on m2o dropdown do not close editable row', async function (assert) {
+ assert.expect(2);
+
+ const list = await createView({
+ View: ListView,
+ model: 'foo',
+ data: this.data,
+ arch: '<tree string="Phonecalls" editable="top">' +
+ '<field name="m2o"/>' +
+ '</tree>',
+ });
+
+ await testUtils.dom.click(list.$buttons.find('.o_list_button_add'));
+ await testUtils.dom.click(list.$('.o_selected_row .o_data_cell .o_field_many2one input'));
+ const $dropdown = list.$('.o_selected_row .o_data_cell .o_field_many2one input').autocomplete('widget');
+ await testUtils.dom.click($dropdown);
+ assert.containsOnce(list, '.o_selected_row', "should still have editable row");
+
+ await testUtils.dom.click($dropdown.find("li:first"));
+ assert.containsOnce(list, '.o_selected_row', "should still have editable row");
+
+ list.destroy();
+ });
+
QUnit.test('width of some of the fields should be hardcoded if no data (grouped case)', async function (assert) {
const assertions = [
{ field: 'bar', expected: 70, type: 'Boolean' },