Wednesday, October 4, 2023
4 changes · master
Code cleanup and technical improvements
This change streamlines how Odoo processes and reuses view layouts across several apps. It reduces repeated internal conversions, making the code easier to maintain and helping future access-rights and view-related improvements be implemented more safely.
Original PR description
*board,mail,project This commit aims to simplify the XMLParser logic and the way archs are manipulated in views, motivated by [1] where we had to modify the arch in View to insert access right…
*board,mail,project This commit aims to simplify the XMLParser logic and the way archs are manipulated in views, motivated by [1] where we had to modify the arch in View to insert access right information. First, the xml utils have been reworked. The XMLParser class has been removed. The xml utils module already exported a parseXML and a serializeXML functions, this commit adds visitXML, s.t. the whole XMLParser feature is fully replaced by the 3 functions. Second, concrete views now receive the arch in props as an XMLDocument, as the arch is parsed once for all in View. With this, we were able to remove serializing/parsing back and forth at several places, where we needed to extract information for sub-parts of an arch individually (e.g. View, x2many subviews, list view groupby). Third, even though this change has been driven by the one above and wasn't initally wanted, the view compiler cache and API have been simplified. The cache is now flat, there's an entry in the cache for each template that has been compiled. Moreover, the useViewCompiler hook no longer takes the cache key in params, as it can directly compute it itself (the key being the outerHTML of the template). [1] https://github.com/odoo/odoo/pull/135145
This refactoring simplifies how Odoo Discuss prepares and stores message-related data, especially for guest and registered users. It reduces internal complexity and helps keep chat, live chat, and notification behavior consistent without introducing a visible feature change.
Original PR description
1. simplify message reaction formatter (personas) Data was formatted to have "partners" and "guests" entries, both of which contribute to personas. To avoid some post-processing of data in JS, it's best to format data to immediately include type of persona. 2. include "guestAuthor" in "author" data of message Discuss models in JS group partners and guests into a single model Persona, to make feature works regardless on whether user is authenticated or not. This commit simplifies code by removing data `guestAuthor` in message formatted data, and instead `author` contains author data in all cases, whether the author is a partner or guest. 3. simplify insert (remove id, redundant with preinsert) - Also rename `Follower.isActive` to `Follower.is_active`, for even simpler `Follower.insert()`
This update removes an obsolete internal error-identification step from the Point of Sale code. It reflects earlier POS refactoring work and helps keep the system simpler without changing day-to-day user behavior.
Original PR description
After the the POS refactoring, there are no more errors of type `legacy`, so the function `identifyError`, whose objective was to identify the `legacy` errrors, is now completely useless. We thus remove it. Task: 3524670 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This update modernizes how several Odoo Enterprise views read and adjust their screen layouts after related platform API changes. It mainly keeps marketing automation, reporting, planning-style views, maps, and Studio compatible and easier to maintain, with little expected day-to-day user impact.
Original PR description
This commit is the counterpart of https://github.com/odoo/odoo/pull/136376. We had to adapt view arch parsers and uses of xml utils as their API changed.