Thursday, January 4, 2024
2 changes · master
Code cleanup and technical improvements
This change updates how Odoo apps receive internal real-time notifications, moving them to a more direct subscription method. It reduces unnecessary processing and lowers the risk of missed or incorrectly handled notifications across messaging, point of sale, surveys, and web editing.
Original PR description
*: mail, point_of_sale, pos_adyen, pos_online_payment,
pos_online_payment_self_order, pos_restaurant, pos_self_order,
pos_viva_wallet, survey, web_editor.
Since [1], it's possible to subscribe to the bus service with a single
notification type. The new approach is better since:
- Listeners do not need to iterate through every notification to detect
if they are interrested in some of them.
- Payload is already extracted from the `OdooEvent` (avoid cumbersome
syntax `({ detail: notifications })`.
- Better separation of concern: one listener, one action.
- Modifying the payload in place does not corrupt the payload of other
listeners.
- No risk to call `return` in the middle of the loop and to potentially
miss some notifications.
This PR removes the support for the `notification` event on the bus
service itself and adapt the code to use `subscribe` instead.
[1]: https://github.com/odoo/odoo/pull/120893
enterprise: https://github.com/odoo/enterprise/pull/53496This change updates how several Odoo apps receive internal real-time messages by removing an older notification event dependency. It should make the underlying messaging architecture cleaner while keeping user-facing behavior consistent across IoT, point of sale, spreadsheets, knowledge collaboration, and VoIP.
Original PR description
*: iot, pos_preparation_display, pos_restaurant_appointment, spreadsheet_edition, voip. community: https://github.com/odoo/odoo/pull/147747