Monday, December 9, 2024
5 changes · saas-17.4
Resolved issues and error corrections
This fix lets scheduled automated jobs run successfully even when assigned to a non-administrator user. It prevents background processes from silently failing because they lacked permission to record their progress, improving reliability for routine operations.
Original PR description
Step to reproduce: - Set any non-admin user as the cron scheduler - The cron won't run as the permission required to create the ir.cron.progress are admin 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
This fix ensures restaurant POS orders keep their correct status even if staff quickly return to the floor screen after sending an order. It prevents the same order from needing to be sent again, reducing duplicate preparation, operational confusion, and potential waste.
Original PR description
Before this commit, when a user returns back, e.g. to the floor screen after clicking "order" but before the call to sendOrderInPreparationUpdateLastChange completed, the update to the order would…
Before this commit, when a user returns back, e.g. to the floor screen after clicking "order" but before the call to sendOrderInPreparationUpdateLastChange completed, the update to the order would not come through. This specifically happens when a lengthy operation is performed in the calls behind the "order" button, such as calling preparation printers. Example steps to reproduce 1. set up a clean DB with pos_restaurant installed 2. configure an epson printer as preparation printer 3. open the POS session 4. select a table and add some products 5. click on "order" and immediately click on "back" The order status is still in the "to be sent" state, while the printer effectively printed the order. You now have to get back to the table view and send the order changes again if you ever want to complete any payment for that order. It will then send it again to the preparation printer. The end result is inconsistencies between the pos session and the database in terms of data. In terms of business flows and operations, it results in multiple sends of the same order, which in turn could lead to losses e.g. due to wrong preparations/unneeded preparations. opw-4367939 opw-4246953
The administrator device list now avoids doing the same sorting work twice, which dramatically reduces load time when viewing many device records. This improves responsiveness for database administration screens without changing the information shown to users.
Original PR description
Issue: ------ Commit 749e0af3639d243f1d24e40f9c0d374c634eaf79 improves the performance of the `res.device` model in the case of a filtered search (for a given user or a given id). However, when the…
Issue:
------
Commit 749e0af3639d243f1d24e40f9c0d374c634eaf79 improves the performance of the `res.device` model in the case of a filtered search (for a given user or a given id).
However, when the search is not filtered it takes a long time. This scenario occurs when an administrator goes to the list view of this model.
Cause:
------
This is because, although the data in the view is already ordered, the ORM explicitly adds an order (by default, `ORDER BY 'res_device'.'id'`). The re-sort forces an exhaustive search (before satisfying the limit) which is very time-consuming given the amount of data.
Solution:
---------
Remove the sort in the non-materialised view and let the ORM add it, thus sorting the data just once.
Note:
Optimisations on this view only work if a limit is applied.
Appendices:
-----------
For the query: `SELECT * FROM res_device ORDER BY id LIMIT 80`
Before:
```
Limit (cost=723566.00..723566.20 rows=80 width=154) (actual time=18565.185..18565.198 rows=80 loops=1)
-> Sort (cost=723566.00..728832.00 rows=2106398 width=154) (actual time=18453.028..18453.036 rows=80 loops=1)
Sort Key: d.id
Sort Method: top-N heapsort Memory: 66kB
-> Sort (cost=641185.54..646451.53 rows=2106398 width=154) (actual time=17845.533..18159.999 rows=2355457 loops=1)
Sort Key: d.last_activity DESC
Sort Method: external merge Disk: 348000kB
-> Merge Anti Join (cost=1.11..419946.90 rows=2106398 width=154) (actual time=0.043..15869.920 rows=2355457 loops=1)
Merge Cond: ((d.user_id = d2.user_id) AND ((d.session_identifier)::text = (d2.session_identifier)::text))
Join Filter: ((NOT ((d2.platform)::text IS DISTINCT FROM (d.platform)::text)) AND (NOT ((d2.browser)::text IS DISTINCT FROM (d.browser)::text)) AND ((d2.last_activity > d.last_activity) OR ((d2.last_activity = d.last_activity) AND (d2.id > d.id))))
Rows Removed by Join Filter: 64036293
-> Index Scan using res_device_log__composite_idx on res_device_log d (cost=0.56..230733.16 rows=4674167 width=154) (actual time=0.018..3639.566 rows=4679317 loops=1)
-> Index Only Scan using res_device_log__composite_idx on res_device_log d2 (cost=0.56..142436.83 rows=4674167 width=73) (actual time=0.005..6216.295 rows=64036294 loops=1)
Heap Fetches: 4284155
Planning Time: 0.402 ms
Execution Time: 18588.272 ms
```
After:
```
Limit (cost=0.99..117.94 rows=80 width=154) (actual time=0.028..0.974 rows=80 loops=1)
-> Nested Loop Anti Join (cost=0.99..3079343.32 rows=2106398 width=154) (actual time=0.027..0.968 rows=80 loops=1)
-> Index Scan using res_device_log_pkey on res_device_log d (cost=0.43..202459.12 rows=4674167 width=154) (actual time=0.012..0.118 rows=138 loops=1)
Filter: (NOT revoked)
Rows Removed by Filter: 3
-> Index Only Scan using res_device_log__composite_idx on res_device_log d2 (cost=0.56..0.61 rows=1 width=73) (actual time=0.006..0.006 rows=0 loops=138)
Index Cond: ((user_id = d.user_id) AND (session_identifier = (d.session_identifier)::text))
Filter: ((NOT ((platform)::text IS DISTINCT FROM (d.platform)::text)) AND (NOT ((browser)::text IS DISTINCT FROM (d.browser)::text)) AND ((last_activity > d.last_activity) OR ((last_activity = d.last_activity) AND (id > d.id))))
Rows Removed by Filter: 6
Heap Fetches: 9
Planning Time: 0.368 ms
Execution Time: 0.996 ms
```Scheduled automated tasks can now run when assigned to a non-admin user. This prevents background jobs from silently failing due to missing internal permissions, improving reliability for teams that delegate scheduler ownership.
Original PR description
Step to reproduce: - Set any non-admin user as the cron scheduler - The cron won't run as the permission required to create the ir.cron.progress are admin 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
Users are now prevented from uploading unsupported files, such as images or non-PDF documents, in quotation template header and footer pages. This avoids save-time errors and keeps the PDF quote builder workflow reliable.
Original PR description
Currently an exception is arising when user upload a image or none pdf file in 'Header or Footer pages'. Steps to produce an error: - Install `sale_management` and go to Sales - Click Configuration > Quotation Templates > open or create quotation template - Click on `PDF Quote Builder` tab - Upload none pdf file on `Header or Footer pages` > Save Record Error: `PyPDF2.errors.PdfReadError: EOF marker not found` This commit will fix the above issue by preventing uploading non-supported files that were uploaded by users. sentry-5962839786