Daily updates from Odoo
Sunday, May 4, 2025
1 change
Code cleanup and technical improvements
Autocomplete suggestions now use a clearer, consistent format, making it easier for different types of suggestions to behave correctly. This is mainly an internal cleanup that should improve maintainability and reduce edge-case issues in selection behavior for areas like Frontdesk and Social Twitter.
Original PR description
This commit changes the structure of the AutoComplete's source options. Before, there was no structure at all, we could give anything in the option except the key "id". If we wanted to give a…
This commit changes the structure of the AutoComplete's source options. Before, there was no structure at all, we could give anything in the option except the key "id". If we wanted to give a property "id", we need to `Object.getPrototypeOf` the option because AutoComplete set a custom id. We also had to give a prop `onSelect` to AutoComplete which was called when we select an option (by click or enter in keynav). When we wanted different "types" of option which do different action on select, this prop needed to separate those "types". Now, the structure is: - cssClass?: string | string[] | Record<string, boolean> - data?: any - label: string | LazyString | Markup - onSelect?(): MaybePromise<void> where data is all the info we want to use in the template at rendering. `onSelect` is now defined at option level to make distinction between option "types". This property is optional and when omitted the option is considered as not selectable (cannot click on it and skipped in keynav).