[FIX] mass_mailing: fixes save filter glitch

In the mass mailing form, when clicking on the filter save button, the screen
was unexpectedly scrolling down. This fixes this problem.

Task-2793090

closes odoo/odoo#86789

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Pierre-Yves Dufays
2022-04-21 17:41:41 +02:00
parent 40c2ae4053
commit daae6063cd
2 changed files with 3 additions and 1 deletions
@@ -103,7 +103,7 @@ const FieldMailingFilter = FieldMany2One.extend({
_onFavoriteFilterDropdownShown(ev) {
const filterInput = ev.target.querySelector('input.o_mass_mailing_filter_name');
filterInput.value = '';
filterInput.focus();
filterInput.focus({ preventScroll: true });
},
/**
@@ -151,6 +151,8 @@ QUnit.module('favorite filter widget', {
"should have option to remove filter if filter is already set");
assert.isNotVisible(form.$('.o_mass_mailing_save_filter_container'),
"should not have option to save filter if filter is already set");
// Ensures input is not focussed otherwise clicking on it will just close the dropdown instead of opening it
form.$('.o_field_many2one[name="mailing_filter_id"] .o_input_dropdown input').blur();
await testUtils.dom.click('.o_field_many2one[name="mailing_filter_id"] input');
assert.containsN($dropdown, 'li.ui-menu-item', 2,
"there should be two existing filters");