Thursday, April 20, 2023
8 changes · master
Enhancements to existing features
Users can now use saved favorites inside Knowledge embedded views, making it easier to reuse preferred filters and views in shared content. This improves consistency and convenience when working with embedded Odoo data in Knowledge.
Original PR description
Purpose ======= Allow to use favorite in Knowledge embedded view. For that purpose, we need to hook some function in the web module (because the favorite are store in the view arch, and not with ir.filters records). Task-3251129
This update prepares the Knowledge app for real-time collaborative editing by making complex Knowledge blocks safer to render, save, and share between users. Collaboration is not enabled yet because related editor issues still need to be fixed, but the changes reduce future data-loss risk and improve readiness for multi-user editing.
Original PR description
# Implement the collaborative mode in Knowledge /!\ This PR does not enable the collaborative mode in Knowledge, because some collaborative errors are in the process of being fixed in the…
# Implement the collaborative mode in Knowledge /!\ This PR does not enable the collaborative mode in Knowledge, because some collaborative errors are in the process of being fixed in the `web_editor` module. see task: 3217965, as well as the traceback `InvalidStateError, failed to execute setRemoteDescription on RTCPeerConnection`, which will be investigated soon. In the meantime, the `collaborative` option of the html_field should stay `false`, because there is a risk of data loss as long as those bugs are present. Here are the necessary changes to make it possible to enable the collaborative mode in Knowledge. Knowledge commands introduce a new kind of editor blocks: `Behaviors`, which are OWL `Component` which need to be mounted. This mounting is asynchronous and this has to be supported, while not all nodes are observed by the editor, meaning that parts of a `Behavior` can be collaborative while others may not. The following is a brief introduction for every commit in this PR, check them out individually for more detail. ### [MOV] knowledge: move the abstract_behavior wysiwyg template - Move the abstract_behavior wysiwyg template with other similar templates in `knowledge_editor.xml` ### [IMP] knowledge: remove duplicate editor getter - The `get editor` was unnecessarily overrided with the same implementation. ### [IMP] knowledge: fully implement oeProtected and oeTransientContent - Those attributes will allow a fine control on which nodes are NOT observed by the editor (oeProtected="true"), and which nodes are NOT saved/serialized for collaboration by the editor (oeTransientContent="true"). It allows `Behavior` OWL lifecycle steps (like `onMounted`, `onPatched`) to not use the `observerUnactive` method to make changes in the editor, which was hazardous as some steps are asynchronous (so there could be a lock active during an asynchronous task). - Every `Behavior` is now `oeProtected="true"` by default, and can specify which of its sub-nodes are `oeProtected="false"` (meaning they should be observed by the editor and collaborative). - An usage example of `oeTransientContent="true"` is an embedded view, as its content is generated dynamically each time, and in the context of the current user, meaning that sharing those nodes in collaboration or saving them in the database does not make sense. - As OWL `mount` is asynchronous, this commit introduces a way to "pre-render" `Behaviors` in a `d-none` div aside the editable, so that the `Behavior` fully rendered can be inserted at once in the editable. (this is to avoid generating multiple `add` mutations during the rendering process, which could be decoupled in collaboration, breaking the rendering logic.) ### [IMP] knowledge: avoid OWL instructions in unprotected Behavior nodes - OWL template instructions can add empty text nodes in the DOM after rendering (i.e `t-if`, `t-else`). If those nodes are observed by the editor (under a `oeProtected="false"` parent), this means that functionnally identical content could have technical differences and not be considered the same by the editor. As such, the current solution is to avoid those instructions under a `oeProtected="false"` parent and handle conditional content manually in the `Component`. ### [IMP] knowledge: make articles structures collaborative - The /index command creates a block with content generated by OWL, so we are exactly in the case mentionned in the previous commit. That content should thus be handled outside of the OWL template. And this requirement is reinforced by the fact that we want to let the editor override those rendered nodes from a collaborator mutation (external step). (OWL crashes if its rendered nodes are modified without its consent). - Therefore this commit introduces the necessary changes for that command to work properly in collaboration. ### [IMP] knowledge: setup embedded view intersectionObserver in editable - The intersection observer for embedded views does not catch the moment when a "pre-rendered" node is moved from the `d-none` rendering zone to the editable. Therefore it is only set up once in the editable, with the usage of a temporary mutation observer. ### [IMP] knowledge: insert external embedded views in collaboration - When joining an html_field in collaborative mode, there is no way to know if there are connected collaborators before actually making said connection. This is a problem when we want to automate the insertion of an embedded view from another module in Knowledge. - This commit uses the hook introduced in `web_editor` to attempt the insertion a second time if the content received from the database where the embedded view was inserted the first time is reset from the currently active collaborator when the current user joins him in collaboration (`onHistoryResetFromSteps`). ### [IMP] knowledge: buffer external steps during Component rendering - In a collaboration, when applying a step requiring a custom OWL `mount` (which is asynchronous), further external steps should be buffered while the rendering is done, in case those following external steps should concern "rendered" nodes which are not yet present in the editor. Once all nodes are rendered and present in the editor, further steps can be applied safely. - This commit uses the option introduced in `web_editor` to provide a promise when it detects that a step added a new `Behavior` anchor node, and that promise will be resolved when the `Behavior` is fully rendered and ready. See odoo/odoo#104680 See odoo/upgrade#4384
Knowledge users can now save favorites such as default searches and groupings directly inside embedded views. These favorites stay specific to each embedded view, making repeated analysis easier without affecting other views.
Original PR description
Purpose ======= Support favorite in embedded views and be able to have default search, group by, etc... Specification ============= The favorite / default search - group by, are defined per view. It means that if you create a favorite for an embedded view, it won't be visible for the other views (even if they share the same parent). Technical ========= The favorite are saved in the HTML arch of the view, instead of creating real `ir.filters` records. The reason is that `ir.filters` are defined for an action, or for the entire model. Embedded view have no action and no id, they are just inserted into the HTML body. If we wanted to create a special model for that, we would have need to clean those records in a CRON, which means parsing HTML to know which view has been removed, etc. So it made more sens to store it in the arch (we remove the view from the body, we remove its filter as well). Task-3251129
Resolved issues and error corrections
This fixes an issue where selecting fields such as Sales Team on mobile could show the wrong list view in newer Odoo versions. The change updates how related kanban views are referenced so users see the intended selection interface across Sales, CRM, POS Sales, and website sales flows.
Original PR description
Steps to reproduce: - Install Sales. - Go to any quotation and toggle mobile device mode in the browser. - Go to Other Info > click in Sales Team field. Issue: We stop supporting the 'kanban_view_ref' in newer versions of odoo. So we won't be able to get proper view. Solution: Changed the way we ref the kanban view to use context to get the referenced kanban view. Related to #[39499](https://github.com/odoo/enterprise/pull/39499) opw-3152174
Manufacturing orders for serial-tracked products can now be completed correctly after using Mass Produce. This prevents an error that blocked users from validating split production orders, helping production teams finish batches without manual workarounds.
Original PR description
Description of the issue/feature this PR addresses: Issue : When mass producing a tracked product, an User Error is raised on validation of splitted MO. Reproduction : - Create Serial storable product "Component A", Lot storable product "Component B", Serial Storable product "Finished Serial Product" - Immediate Transfer 10 * "Component A" and 20 * "Component B" - Create a BoM for "Finished Serial Product", consuming 1 * "Component A" and 2 * "Component B" - Create a Manufacturing Order for 10 * "Finished Serial Product" and Confirm - Click on "Mass Produce", Set "First SN", Generate all the serials and Apply - Click on "Produce All" on the splitted MO Current behavior before PR: User Error Desired behavior after PR is merged: Working fine Task : 3274962 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
A recent internal refactoring accidentally removed handling for simple notification alerts used by several Odoo apps. This fix restores those alerts so users continue to see important messages with the expected warning or danger level.
Original PR description
* = base_geolocalize, calendar, website_crm_partner_assign Oversight of discuss refactoring. Code is restored into bus module as it does not depend on any mail or discuss feature. ----- Note: default type (unless `warning` was specified) was `danger` before https://github.com/odoo/odoo/blob/5da763a8ef0503286fa5cc55e32970f4d785825a/addons/mail/static/src/models/messaging_notification_handler.js#L429 and now the default from notification service is kept (it is `warning`) so `danger` is added in code to keep the same behavior.
Odoo Studio now correctly ignores fields that a user is not allowed to access when opening or editing views. This prevents access rights errors and lets users continue working in Studio even when a view contains restricted fields.
Original PR description
Commit @baebb6a5b05ac8d59501a6071a5513e31a4ca047 introduced a universal way to handle multiple instances of the same field in a view arch. To do so, it separates what fields are to be fetched (activeFields) from the "instances" of those fields in the arch (fieldNodes). Studio's code was only partially ready, relying on the fact that the key for fieldNode was the field's name, which isn't true any longer. This commit fixes that, and removes from the fieldNodes the ones that have studio_no_fetch and more importantly removes them from activeFields. To reproduce: have a field with a group declared in python, which the user doesn't have. Open studio with a view that has that field in the arch. Before this commit, there was an access rights crash. After this commit, there is no crash.
Users can now insert links to Odoo menus in spreadsheets without being unexpectedly sent back to the Odoo home page. The menu picker also better reflects the currently selected item and includes apps, making accidentally removed app links easier to restore.
Original PR description
This PR fixes the problem when inserting a link to an odoo menu, clicking the menu item in the dropdown will jump to odoo home page, and the insertion fails. The root cause is the menu item uses `a` tag and has a `href` leading to home page. The solution is to prevent the default clicking behavior. This PR also fixs a small bug of showing currently selected menu item. task [3159543](https://www.odoo.com/web#id=3159543&cids=1&menu_id=4720&action=333&active_id=2328&model=project.task&view_type=form)