Monday, February 27, 2023
3 changes
Code cleanup and technical improvements
This internal cleanup makes dialog handling available in the control panel setup registry, helping Odoo screens use pop-up interactions more consistently. The change should make future interface work easier while having little direct impact on day-to-day users.
This change removes older dialog-closing behavior in Gantt, Grid, and Studio views because related records now open automatically in their own dialog. Users get a cleaner navigation experience with fewer redundant dialog changes.
Original PR description
This reverts commit ba0e95fe42696dcf44b8feddeb302f04876fcbdc. Because of odoo/odoo#112956, we no longer need this commit as the related record now automatically opens in another dialog.
This update replaces an older internal event-handling approach in German POS certification and IoT POS areas with patterns better suited to the newer interface framework. It should make point of sale behavior more reliable, especially in edge cases like loading or switching browser tabs, without changing business workflows.
Original PR description
*:l10n_de_pos_cert,pos_iot Previously, the point of sale and related modules made heavy usage of `useListener`. This is because the pos was converted early to owl, and in owl 1, using events to…
*:l10n_de_pos_cert,pos_iot Previously, the point of sale and related modules made heavy usage of `useListener`. This is because the pos was converted early to owl, and in owl 1, using events to communicate between components was encouraged. In owl 2, the decision was made to stop encouraging this way of communicating between components, because it encourages communication accross many layers of components, and is also hard to debug. In addition, in owl 2, because components can have 0 or more than node, including non HTMLElement nodes like text or comment nodes, owl removed the implementation of useListener, as useListener relies on the presence and unicity of a root HTMLElement per component on which we can attach event listeners. Another problem is that events rely on the fact that the components are in the DOM so that the event can propagate, which can lead to issues in some cases and in particular, in the PoS, if you load the point of sale and switch tabs, some things will be broken because we are triggering events, but there have not been any animation frame fired in the tab because it's not focussed, and so owl has not mounted the component yet. When migrating odoo to owl 2, we introduced a shim for this.el and useListener in LegacyComponent, with the hope to remove it as soon as possible. This commit removes all usage of useListener from the pos modules for those reasons. In some cases, useListener was incorrectly used intstead of t-on, and the event was triggered and handled by the same component, in other cases, a simple callback could be passed to a child component. In a few cases, a method had to be implemented on the store as we wanted this method to be available everywhere. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr