[FIX] web: click on wrong options in autocomplete

The purpose of this commit is to fix an indeterminate error in
the test_03_sale_quote_tour.

Error: UncaughtTypeError: Cannot read properties of undefined (reading
'unselectable')

Why:
In the autocomplete component, it is possible to replace the sources
without it being rerender. It is therefore possible to click on a option
that no longer exists in the component's internal state, which causes
the crash.

Solution:
We wait that all the sources are loaded before replacing them.

closes odoo/odoo#103497

X-original-commit: f25df0be75082caf9e8ed62c581a13fe82a27546
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Georis François (fge) <fge@odoo.com>
This commit is contained in:
FrancoisGe
2022-10-20 10:19:47 +02:00
parent af6178e628
commit 70a80d4cd1
2 changed files with 2 additions and 3 deletions
@@ -12,8 +12,6 @@ odoo.define('mass_mailing.mass_mailing_editor_tour', function (require) {
trigger: 'button.o_list_button_add',
}, {
trigger: 'div[name="contact_list_ids"] .o_input_dropdown input[type="text"]',
}, {
trigger: 'li.ui-menu-item',
}, {
trigger: 'div[name="contact_list_ids"] .ui-state-active'
}, {
@@ -91,8 +91,9 @@ export class AutoComplete extends Component {
source.options = options.map((option) => this.makeOption(option));
}
}
this.sources = sources;
Promise.all(proms).then(() => {
this.sources = sources;
this.navigate(0);
});
}