Thursday, February 9, 2023
2 changes · master
Code cleanup and technical improvements
This update simplifies the internal structure of Odoo's Point of Sale apps by removing an outdated shared component and moving responsibilities to clearer places. It should make future maintenance and improvements easier, with little to no direct change for daily users.
Original PR description
*: pos_discount, pos_hr, pos_loyalty, pos_restaurant, pos_sale, pos_six Previously, all components in the pos and related apps would inherit from the PosComponent base component, this component…
*: pos_discount, pos_hr, pos_loyalty, pos_restaurant, pos_sale, pos_six Previously, all components in the pos and related apps would inherit from the PosComponent base component, this component contained a bunch of methods that were as such available on every component in the pos passively. In previous commits, a bunch of these methods have been moved either to the pos store or to their own services, so that component dependencies are explicit instead of every component having a clobbered namespace and having access to everything implictly. This commit factors out the last method of the PosComponent, `setSyncStatus` and as such the PosComponent is now empty and can be removed completely, as can the Gui singleton utility which was used to access these methods from outside of components. Components in the pos modules now inherit from LegacyComponent which PosComponent extended. The end goal is to remove the use of LegacyComponent as well, but currently it is still needed as components in the pos modules make extensive use of `useListener` which requires the shim for `this.el` provided by LegacyComponent. This is nonetheless a first step in that direction. This commit also removes some components that were used in the navbar as they were very small and it made more sense to just have the behaviour they implement directly in the navbar component or elsewhere. Most of the CashMoveButton was moved to the CashMovePopup, the TicketButton has so little behaviour that moving that behaviour to the navbar itself makes sense.
This update aligns the IoT and Point of Sale IoT components with recent platform changes so they continue to work with the latest shared code. It also corrects a naming typo to keep the enterprise and community versions consistent.
Original PR description
The corresponding community commit removes PosComponent completely, this commit adapts the code to use LegacyComponent instead. It also fixes a typo: `servicesDependencies` => `serviceDependencies` to use the same spelling as in community.