Daily updates from Odoo
Tuesday, December 9, 2025
25 changes · saas-18.3
Enhancements to existing features
This update expands the flexibility for setting Service Level Agreements (SLAs) on helpdesk tickets. Previously, a key domain was hardcoded, but now other modules can adjust it, allowing for more customized SLA rules. This improves the adaptability of our helpdesk system.
Original PR description
Allow other modules to modify the _sla_find domain when adding SLAs to helpdesk tickets. This is already the case for extra and false domains, while the main domain is hardcoded up to this commit. Forward-Port-Of: odoo/enterprise#97501
Resolved issues and error corrections
This update fixes an accounting error related to invoice posting in the Vietnamese localization. Previously, the system incorrectly created entries for both receivable and payable accounts for 'Unearned Revenue' (account 3387). Changing the account type to 'Current Liabilities' ensures accurate financial reporting and prevents mismatched balances.
Original PR description
When posting an invoice, the system creates: - Journal Entry: Dr 131 (Receivable) / Cr 511 Then the system creates a deferral entry: - Deferral entry: Dr 511 / Cr 3387 (Payable) Falsifying the…
When posting an invoice, the system creates: - Journal Entry: Dr 131 (Receivable) / Cr 511 Then the system creates a deferral entry: - Deferral entry: Dr 511 / Cr 3387 (Payable) Falsifying the Balance sheet report, in the accounts receivable and accounts payable indicators The issue was that account 3387 was configured as `Payable`, which caused the system to generate both Receivable (131) and Payable (3387) for the same partner. This is incorrect because account 3387 represents "Unearned Revenue", which is a current liability, not a payable account. By changing the account type from `Payable` to `Current Liabilities`, the deferral entry now correctly reflects that 3387 is a current liability account, preventing the incorrect reconciliation behavior where both receivable and payable entries were created for the same partner. After this fix: - Entry: Dr 131 (Receivable) / Cr 511 - Deferral: Dr 511 / Cr 3387 (Current Liabilities) Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#238807 Forward-Port-Of: odoo/odoo#237493
This update simplifies the handling of MPF payments in Hong Kong. Previously, Odoo registered separate payments for MPF alongside wages, creating complexity. Now, MPF accounts are unreconciliable by default, directing accountants to reconcile directly with the government platform, streamlining the accounting process.
Original PR description
Currently, we register two separate payments for MPF at the same time as we do for the employee's wages. This is not what we want to do; as both are not paid at the same time. MPF is also handled separately, and paid outside of Odoo on the government platform, making the registration of separate payments more complex for not many benefits. Thus, we make these accounts un-reconcilable by default, and will expect accountants to reconcile the statement with the account directly. task-5349299 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#238074
This update resolves an issue where marking multiple manufacturing orders as 'Done' would trigger an error due to how the system handles different unit of measure (UoM) values. The fix ensures accurate calculations and prevents the error when multiple orders with varying UoMs are marked as complete, improving data integrity.
Original PR description
Currently, an error occurs when user marks multiple Manufacturing Orders as Done. **Steps to Reproduce…
Currently, an error occurs when user marks multiple Manufacturing Orders as Done.
**Steps to Reproduce ([Video](https://drive.google.com/file/d/1XfkMB001rMiyulRGrP4dlJFDYByo_5Bv/view?usp=drive_link)):**
- Install the `mrp` module.
- Go to `Settings` and enable `Units of Measure & Packagings`.
- Go to `Products and `create two products` with different `units of measure`.
- Go to `Manufacturing Orders`, create a manufacturing order by `adding one of the products`, and then `create work order` in the Work Orders section and `confirm` it.
- Create another `manufacturing order` with the `same quantity` for the second product and add a `Work Order` for it as well and `confirm` it.
- Go to the `list view`, select `both orders`, and click `Mark as Done` from the `Actions` menu.
**Error:**
```
ValueError: ValueError('Expected singleton: uom.uom(4, 6)') while evaluating
"if records:\n res = records.filtered(lambda mo: mo.state in {'confirmed', 'to_close', 'progress'}).button_mark_done()\n if res is not True:\n action = res"
ValueError: Expected singleton: uom.uom(4, 6)
```
After [this commit], which improves the performance of button_finish, when a user marks multiple orders as done with the same quantity but different uom , it creates all_vals_dict based on the vals[1] data as the key and the work order as the value[2]. Then it stores two or more work orders with different UoMs under the same vals key. When attempting to write multiple work orders[3], the precision rounding is calculated, which raises the error[4] due to multiple UoMs.
The commit ensures that when writing records, precision_rounding is calculated separately for each Work Order's UoM.
[this commit]: https://github.com/odoo/odoo/pull/223715/commits/b857d192085a38b612335223d04f8bdff91b898c
[1]- https://github.com/odoo/odoo/blob/186a9eb4a6c55c9c4c2178d4b2492a9a23a267fe/addons/mrp/models/mrp_workorder.py#L698-L703
[2]- https://github.com/odoo/odoo/blob/186a9eb4a6c55c9c4c2178d4b2492a9a23a267fe/addons/mrp/models/mrp_workorder.py#L706
[3]- https://github.com/odoo/odoo/blob/186a9eb4a6c55c9c4c2178d4b2492a9a23a267fe/addons/mrp/models/mrp_workorder.py#L708
[4]- https://github.com/odoo/odoo/blob/186a9eb4a6c55c9c4c2178d4b2492a9a23a267fe/addons/mrp/models/mrp_workorder.py#L477
sentry-7050854871
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#238086This update fixes an issue where placeholders were missing in the 'Related Company' field within the Contacts module. The fix ensures that placeholder text is correctly displayed, improving the user experience when creating new contacts. This resolves a minor visual inconsistency.
Original PR description
**Issue:** Fields using the res_partner_many2one widget with a placeholder do not display the placeholder text. **Steps to reproduce:** 1. Install `contacts` module 2. Go to Contacts 3. Create new 'Individual' contact 4. Notice just below the name, Related Company field placeholder is not visible. **Cause:** Props are not passed correctly in PartnerAutoComplete component **Solution:** Use the correct prop reference (props.placeholder) when passing the placeholder to the PartnerAutoComplete component, ensuring it is properly rendered. opw-5153125 Forward-Port-Of: odoo/odoo#235696 Forward-Port-Of: odoo/odoo#231445
This update fixes an issue where timesheet values were incorrectly displayed in project updates, showing an incorrect number of days instead of hours. This change ensures that timesheet hours are accurately converted and presented when creating project updates, improving the reliability of project time tracking.
Original PR description
Similar to: 0104cee Steps to reproduce: -------------------- 1. Install hr_timesheet 2. Create a new project and a task 3. On the task, add a timesheet line with some time (e.g., 16 hours) 4. Open…
Similar to: 0104cee Steps to reproduce: -------------------- 1. Install hr_timesheet 2. Create a new project and a task 3. On the task, add a timesheet line with some time (e.g., 16 hours) 4. Open the project dashboard > create a new project update > observe the timesheet time 5. Go to Timesheets > Configuration > Settings 6. Set "Encoding method" to "Days/Half-days" 7. Reopen the project dashboard > create another project update > observe the timesheet time again Issue: ------ Incorrect value displayed in the Timesheets. (e.g., 16 Days instead of 2 Days) Cause: ------- After commit 28b69da, the UoM model was restructured, changing how conversions between hours and days are computed. https://github.com/odoo/odoo/blob/aeda822db05b218fd1271c7666307950b7a98512/addons/hr_timesheet/models/project_project.py#L137-L143 The `total_timesheet_time` value is now already stored in the final unit (e.g., days). Whenever a new project update is created, the division in `create()` performs an unnecessary second conversion on an already converted value, causing the incorrect display. https://github.com/odoo/odoo/blob/583bacdc8ad2b87b99b11d1e12dacf6e42edf22b/addons/hr_timesheet/models/project_update.py#L36-L37 Solution: ---------- This commit ensures accurate conversion of timesheet values between hours and days. opw-5184077 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#237532
This update resolves an issue where removing a video URL in the website editor would create a broken iframe, leading to a 404 error. The fix ensures that the 'Add' button is disabled when a video URL is empty, preventing the creation of invalid i-frames and improving website stability.
Original PR description
*=website **Steps to reproduce:** 1. Drop a video 2. Reopen the media dialog 3. Remove the URL 4. Confirm **Issue:** When the URL was removed and confirmed, an iframe without a valid source was saved, leading to a 404 error. **Fix:** When the video URL is cleared, VideoSelector component calls selectMedia with an empty object. MediaDialog did not previously handle this case, so the media selection was not cleared. Now we Update MediaDialog to treat an empty object as a clear-selection signal and disable the Add button accordingly. task-5190485 Forward-Port-Of: odoo/odoo#238884 Forward-Port-Of: odoo/odoo#234085
This update resolves an issue that previously blocked users from creating new Amazon accounts within a newly created company. The fix ensures the system correctly handles the absence of initial warehouses and stock locations, allowing for seamless account setup. This improves the user experience and avoids disruptions during company creation.
Original PR description
Currently, an error occurs when user tries to create a new amazon account on a new company. Steps to replicate: - Install `sale_amazon`. - Create a new company and switch to it. - Go to Settings >…
Currently, an error occurs when user tries to create a new amazon account on a new company.
Steps to replicate:
- Install `sale_amazon`.
- Create a new company and switch to it.
- Go to Settings > Amazon account > Try to Create a new account.
Error:
```
File /home/odoo/odoo18/enterprise/sale_amazon/models/amazon_account.py, line 214, in create
'location_id': parent_location_data[0]['view_location_id'][0],
IndexError: list index out of range
```
Cause:
- Whenever a new company is created, it doesnt have any warehouses [1] and amazon stock locations [2].
- This causes the `parent_location_data` to be an empty list and causes error at line [3].
Solution:
- Assigning the `location_id` if the `parent_location_data` exists.
[1]: https://github.com/odoo/enterprise/blob/23f085bdba333807a25a2d41214b25f474c7edf8/sale_amazon/models/amazon_account.py#L206-L210
[2]: https://github.com/odoo/enterprise/blob/23f085bdba333807a25a2d41214b25f474c7edf8/sale_amazon/models/amazon_account.py#L201-L204
[3]: https://github.com/odoo/enterprise/blob/23f085bdba333807a25a2d41214b25f474c7edf8/sale_amazon/models/amazon_account.py#L214
sentry-7086464738
Forward-Port-Of: odoo/enterprise#101465This change prevents distracting audio notifications during Odoo tests. Previously, unexpected sounds from the computer disrupted test runs, causing delays and frustration. This update ensures a cleaner and more reliable testing environment.
Original PR description
When running tests locally, it's really annoying (and sometimes really jarring / surprising) to hear random beeps and boops from your machine, especially when it's an old timey ringtone from voip. Make it stop. Forward-Port-Of: odoo/odoo#238906 Forward-Port-Of: odoo/odoo#238882
This fix resolves a bug where the 'Working Time to Assign' field incorrectly remained at 0 when assigning tasks after a multi-company time off was set. The issue stemmed from a system-wide holiday calculation that didn't account for the specific company of the task, leading to inaccurate working time assignments. This ensures accurate time tracking for tasks across multiple companies.
Original PR description
__ ## Short functional explanation of the error Let's say we have 2 companies: company A and company B. We create a public time off of a few days starting before today and ending 2 days later in…
__ ## Short functional explanation of the error Let's say we have 2 companies: company A and company B. We create a public time off of a few days starting before today and ending 2 days later in company A, then switch back to company B. In company B, we create a project and a task, and assign this task. The working time to assign will stay at 0. ## Reproduction Steps 1. Switch to company A and create a timeoff starting before today and ending later. 2. Switch back to company B. Create a project, a stage and a task. 3. Enable the debugger. 4. The field Working Time to Assign is invisible by default, so open studio, click on View, and check Show Invisible Elements. 5. Click on the tab Extra info and on the block Working time to assign. Uncheck Invisible. 6. Close studio and assign someone to the task. Make sure that you do this operation at a different time than the one recorded for the last stage change. ### Expected behavior The hours under Working Time to Assign should compute the difference between the last time the task got its stage changed and the time of assignation ### Unexpected behavior Nothing happens ## Origin of the issue When computing the working time to assign, we also take into consideration leaves: if this happened during public holidays, we consider that it took no working time to get assigned. However, when a holiday is set in another company, the Working Time to Assign duration will be impacted, as the domain to retrieve the corresponding leaves is the following: https://github.com/odoo/odoo/blob/c7e965a61b7ce856c2daa8e2574cf4c60caf7a20/addons/resource/models/resource_calendar.py#L537-#546 The company isn't taken into account in the domain, applying the holiday for every company. _________________________________________ opw-5222883 Forward-Port-Of: odoo/odoo#236043
This update fixes an issue where portal users encountered errors when filtering job postings due to restricted access rights. The fix applies a security measure (sudo()) to ensure portal users can correctly access and filter department data, improving usability for this user group.
Original PR description
**Steps to reproduce:** 1. Install `website_hr_recruitment` 2. Open the job website page and, through editor add a filter for department 3. Switch to a portal user and change the department filter **Issue:** - The controller passes department_id to the template, but unlike before this commit https://github.com/odoo/odoo/commit/0ab6e84c54f134c8744d8f94108a715e989b2815, where the code used sudo() to sort departents https://github.com/odoo/odoo/blob/6159c6527cfa38ea0c92e6f3fa6025ee534a1acb/addons/website_hr_recruitment/controllers/main.py#L81 it now just passes the department_id without actually returning a full record with accessible fields. In the template, the filter rendering uses selected_filter.name, which triggers an AccessError for portal users. **Solution:** - Apply `sudo()` when accessing `hr.department` to avoid access errors for portal users. opw-5103910
This update resolves a technical issue related to how SHA512 hashes are generated during the import of Swedish accounting data. The fix ensures accurate data integrity, preventing potential errors when processing financial information. This improves the reliability of the Odoo Enterprise system for Swedish users.
Original PR description
Forward-Port-Of: odoo/enterprise#101511
This update fixes an issue where form fields, specifically those with 'Text' input types, were displaying a placeholder of 'null' instead of an empty field. This change ensures a cleaner and more intuitive user experience when creating or editing forms on the website.
Original PR description
Steps to see the issue: - Open website and start editing - Drop a form - Add a new field, or click on an optional field, the type of which we can modify - Set the field type to 'Selection' or 'Radio Buttons' (or any other that does not have placeholders) - Set the field type back to 'Text' => Field's placeholder is `'null'`, but it should just be empty. task-5383835 Forward-Port-Of: odoo/odoo#238710
This update resolves an issue preventing the IoT Box upgrade script from correctly updating the Odoo configuration file. By using sudo and installing pip requirements as the Odoo user, the script now has the necessary permissions and avoids potential security vulnerabilities. This ensures smoother and more reliable upgrades for IoT Box deployments.
Original PR description
On 25.06 images, the IoT Box upgrade script can't update `odoo.conf` file (modules to load) as odoo user running sed doesn't have enough permissions. We now run this command with sudo then ensure the ownership of the file is still `odoo:odoo` We now also ensure that pip requirements are installed for user `odoo` instead of root. Task: 5383045 Forward-Port-Of: odoo/odoo#238553
This update fixes an issue where changing the quantity of a combo product in Point of Sale (PoS) didn't correctly update the quantities of its child items. Specifically, when quantity changes are restricted, the system now accurately adjusts the quantities of all items within a combo. This ensures accurate order totals and prevents over-selling.
Original PR description
When changing the quantity of a combo parent product in a PoS that doesn't allow changing quantity (like when using blackbox), the children of the combo would not be updated correctly. Steps to reproduce: ------------------- * Open any PoS and use this command to change the behavior of changing quantity : `posmodel.disallowLineQuantityChange = () => true;` * Add any combo product to the order. * Change the quantity of the combo parent product to 0 > Observation: The children of the combo are still there. Why the fix: ------------ We make sure to adapt the quantity of the combo children when the parent quantity is changed. opw-4876979 Forward-Port-Of: odoo/odoo#239078 Forward-Port-Of: odoo/odoo#224651
This update fixes an issue where timesheets weren't correctly reflecting new employee's time off requests. The change ensures that only global time offs are considered, preventing incorrect timesheet generation when creating new employees with specific leave configurations. This improves the accuracy of time tracking and reporting.
Original PR description
**Steps to reproduce** 1. Have a future `resource.calendar.leaves` without a `calendar_id` but with a `resource_id`. To achieve this, you can for example install Payroll and Attendance, create a contract with the work entry source being attendances and with no working schedule. Then, create a time off in hours for that employee and validate it. In that case, the `hr.leave` has no `resource_calendar_id` as computed in `_compute_resource_calendar_id`. This leads to a `resource.calendar.leaves` record without a `calendar_id` once the time off is validated. 2. Create a new employee. A timesheet corresponding to the previously created time off is created. **Change** Make sure only global time offs are considered. opw-5248992 Forward-Port-Of: odoo/odoo#237773
This update resolves an issue where clicking a Field Service record in the kanban view with the middle mouse button opened it in the same tab. The fix ensures that records now open in a new tab, improving user workflow and efficiency. The change was triggered by a bug in the `industry_fsm` module.
Original PR description
Steps to reproduce: 1. Install `industry_fsm` 2. Open Field service module 3. In the kanban view, click a record with the middle mouse button Issue: - The record opens in the same tab instead of a new tab. Cause: - `FsmMyTaskKanbanRecord` overrides `onGlobalClick` without propagating the `newWindow` argument, preventing the expected new-tab behavior. Solution: - Forward the `newWindow` parameter to the parent implementation to restore the correct handling of the middle mouse click opw-5351842 Forward-Port-Of: odoo/enterprise#100926
This update fixes an issue where outdated sub-channels were being unnecessarily unpinned, leading to unwanted notifications. The change also prevents unpinning sub-channels if members still have unread messages, ensuring the pin feature continues to work as intended for accessing important threads.
Original PR description
Before this commit, outdated sub-channels were unpinned each time the vacuum ran. It occurs because a condition on sub-channel being pinned is missing. In practice, it's not a big deal funtionnaly but leads to useless notifications being sent. While at it, this PR prevents unpins when there are still unread messages in the sub-channel: the pin feature is used to see unread messages on otherwise hidden threads. Forward-Port-Of: odoo/odoo#238493
This update fixes a problem where Swiss account translations were missing, particularly for payroll documents. This ensured that all official documents were consistently translated, avoiding mixed language issues and maintaining compliance standards. The fix was driven by a specific request to improve the quality of Swiss-localized financial reports.
Original PR description
Some Swiss account translations were missing, mainly related to payroll. This resulted in payroll documents having mixed languages, which is not acceptable for official documents. opw-5343680 Forward-Port-Of: odoo/odoo#239122 Forward-Port-Of: odoo/odoo#239001
This update resolves a potential memory issue that could occur during HR Timesheet installations on databases with many existing accounting records. The change ensures that new data fields are created efficiently, preventing the system from running out of memory and improving the overall installation process. This enhances stability and reduces potential delays for users.
Original PR description
Description ----------- On databases with a large count of existing `account.analytic.line` records, installing modules like `hr_timesheet`, which adds compute stored or related stored fields to this model can trigger a memory error due to the volume of records that need to be recomputed. This commit creates the columns manually with the correct default value that is inferred from the state and implementation of said fields. Reference --------- opw-5234833 opw-5255382 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#239024
This fix addresses a bug in the Mexican localization (l10n_mx_edi_pos) where refunding orders with global discounts could create incorrect invoices. The update now prevents refunds from exceeding the original order total, ensuring accurate invoice generation for Mexican users. This resolves a potential issue with invoice distribution.
Original PR description
When refunding an order that originally had a global discount, if you didn't refund the discount, the refund total amount would exceed the original order total. This would cause issues when trying to…
When refunding an order that originally had a global discount, if you didn't refund the discount, the refund total amount would exceed the original order total. This would cause issues when trying to generate a global invoice for the mexican localization. Steps to reproduce: ------------------- * Activate the global discount option in any PoS * Open PoS and make a sale with a global discount * Refund the sale without including the discount * Go to the backend * Go to the order list and select the 2 orders you made * Now try to create a global invoice > Observation: The global invoice is in error because the negative lines cannot be distributed correctly. Why the fix: ------------ To avoid this issue with the global invoice we simply prevent the user to generate a refund with a greater amount than the original order. We only apply this limit to the mexican localization because it's the only module that is affected by this issue. Other localizations can still refund without restrictions even if this work flow does not really make sense. opw-4899501 Forward-Port-Of: odoo/enterprise#100780 Forward-Port-Of: odoo/enterprise#93101
This update adds an index to the `sale.order.project_id` field, significantly speeding up the loading time of the project settings page. Previously, the system was performing a slow scan of the database, but this change optimizes the query for faster performance, especially with large sales orders.
Original PR description
Description ----------- Following odoo/odoo@238a41e35280256382f6509182b9e900fb4f7aba, the domain for `sale.order.line` in `_get_sale_order_items_query` was modified to search based on the relevant…
Description ----------- Following odoo/odoo@238a41e35280256382f6509182b9e900fb4f7aba, the domain for `sale.order.line` in `_get_sale_order_items_query` was modified to search based on the relevant `order_id` `id` or `project_id`. `project_id` is not indexed, leading to a heavy non-selective scan on the primary key for databases with many `sale. order` records. There is poor selectivity with the filter on `sale. order.line` resulting in a heavy join between `sale.order` and `sale.order.line`. This commit adds the missing index, allowing for `Bitmap Heap Scan` on both indexes and leveraging the selectivity of the project being currently opened. Benchmark --------- On a database with 3.5M `sale.order`, 12M `sale.order.line`, opening the "Settings" page of a project with a few sale lines associated with it took: | | Before | After | |--------------|--------|-------| | Timing (hot) | 9.1s | 5ms | Reference --------- opw-5280364 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#238995
This update fixes a limitation in how barcodes handle rental sales within Odoo. A new hook has been added, allowing businesses to override the standard barcode behavior when processing rental transactions. This ensures accurate tracking and reporting for both barcode scanning and rental sales operations.
Original PR description
Add a hook method to be used in barcode that can be overriden for `sale_stock_renting`. As there is no common module for these two module, this was put in their common ancestor. opw-5265874 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#238753
This update fixes an issue where rental receipts were incorrectly validated without warnings, even when incomplete. The change ensures that rental receipts, which are treated as proper receipts needing partial handling, are processed correctly by adding a check to prevent errors when linked to a stock picking.
Original PR description
Steps to reproduce: - Enable Rental pickings - Create a rental for a product, for 4 quantity - Process the delivery - Open the barcode app and open the reception - Scan the product once and validate…
Steps to reproduce: - Enable Rental pickings - Create a rental for a product, for 4 quantity - Process the delivery - Open the barcode app and open the reception - Scan the product once and validate Issue: The receipt is validated without issues nor warning, despite being incomplete. This is due to a bad mix of two changes: - #60801, which always sets the rental receipt as return of the delivery - #48788, which removes the backorder check for returns in barcode For regular returns made in barcode, it makes sense to avoid the backorder check, as from here we're processing a full picking return and we'd have the confirmation pop every time. However, things are different for rental receipts, as despite them being set as returns of the delivery, they're proper receipts that need to handle the partial receipt. To avoid the issue, rather than removing the backorder check whenever there's a return linked to the picking, now also checks that there isn't a rental order linked to the picking. opw-5265874 Forward-Port-Of: odoo/enterprise#101387
This update optimizes how Odoo searches for products, specifically when using 'like' operators. By restructuring the search query, the system now efficiently utilizes database indexes, resulting in significantly faster search times. This improves the user experience and overall system responsiveness.
Original PR description
When doing a name_search with positive operators (=, ilike, in) the resulting query combines domains with the OR operator. This works fine when the leaves are all on the same table (product_product…
When doing a name_search with positive operators (=, ilike, in) the resulting query combines domains with the OR operator. This works fine when the leaves are all on the same table (product_product or product_template) as postgresql uses a Bitmap OR when everything is properly indexed.
When leaves are on multiple tables however postgresql has to plan a Seq Scan. For instance, let's take a simple domain on product.product of the form `['|', ('name', 'ilike', 'test'), ('default_code', 'ilike', 'test')]`. Because `name` is an inherited field via `product_tmpl_id`, the resulting query has the where clause `join_table.name ilike %s OR product_product.default_code ilike %s` with `join_table` the table you get after joining product_product and product_template. Since it's an `OR` condition, postgresql does not know in advance whether a given row will pass this condition. There's no way to filter the tables before the join. The condition moves therefore to a `Join Filter` node and postgresql has to scan the whole join table to fetch the correct tuples.
Same thing when there's a subquery. In case of a where clause `cond OR cond OR subquery`, postgresql does not know in advance whether or not a given row is gonna pass the subquery condition. So it has to scan the whole table.
In both cases this becomes a bottlneck when the number of products increaases. This commit introduces the use of `UNION ALL` instead of `OR`. There's one SubPlan for each individual table in the domain. The results are then appended to get the final products matching the conditions. Thanks to each table having its own SubPlan postgresql can now properly hit indexes for each table, greatly improving the performances.
#### speedup
In a database with 2.5M product_product, the name_search on product with a partner_id in the context and the ilike operator goes from 8s -> 5ms.
In another database with 500k product_template, the name_search on template with a partner_id in the context and the ilike operator goes from 1.8s -> 5ms.
opw-4921944
opw-5103287
opw-5049054
opw-5256691
opw-5221753
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#229275