Files
odoo_source/addons/web
Aaron Bohy 79727cca9c [FIX] web: AutoComplete: do not crash on "Enter"
Before this commit, there were two kind of related issues with the
AutoComplete component, involving an "Enter" keydown.

1) Click in an empty Autocomplete input s.t. the (only) source has
   no option, then press "Enter" -> crash
2) Enter something in an Autocomplete input s.t. there are results
   in the dropdown, then update the input again s.t. the (only)
   source has no option, then press "Enter" -> crash

This commit fixes those two issues by
1) Ensuring that we don't store in the state an option index that's
   out of range with respect to the current available options
2) Reseting the options when reloading the sources.

Those issues were reproducible on the Company form view, by using
the company name field (which uses partner_autocomplete).

closes odoo/odoo#107982

X-original-commit: 390a9b589495e67235b15137ccc510b76350443f
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-14 22:04:15 +01:00
..
2022-10-06 14:56:52 +02:00