Monday, February 12, 2024
4 changes · 17.0
Resolved issues and error corrections
This update prevents incorrect financial report amounts from being displayed when cross-report aggregations use different date settings than individual report expressions. The system now detects this problematic situation and stops the calculation to alert users, rather than silently showing wrong numbers. The Executive Summary report was also adjusted to work properly with this new safeguard.
Original PR description
When making a cross_report aggregation expression, its date_scope is going to be enforced on all expressions used in its computation. Because of that, if an expression of the current report is…
When making a cross_report aggregation expression, its date_scope is going to be enforced on all expressions used in its computation. Because of that, if an expression of the current report is referenced by such an aggregation, and if this forced date_scope is different from that expression's, this expression will be computed twice, once for each date_scope. However, the modelling of the report makes it so that the second of these computations will overwrite the result of the first one (because the expression totals dict uses expressions directly as its keys). For now, this case is considered unsupported, as its is not common at all, and an easy workaround exist (just use multiple aggregation expressions, and only reference other reports in cross_report expressions). We hence add an exception in the report computation to crash when it occurs instead of displaying potentially wrong amounts. We also fix the NDays expression of the Executive Summary, as they were facing this situation, and hence raised the new exception we introduce here when the report was tested. Though it was a bit useless to compute them twice like that, their custom engine was made in such a way that the result of the computation was unchanged, so we can safely change the date_scope here so that it matches the one used on the aggregations calling them. Forward-Port-Of: odoo/enterprise#55212
This update fixes a performance issue where complex search filters with many conditions would fail in Odoo 17.0. The system now handles large search queries the same way it did in version 16.0, preventing errors when searching with thousands of filter conditions. This is particularly important for warehouse operations and other features that generate large search filters automatically.
Original PR description
In previous versions the max size of a domain was bounded by psycopg memory limits. With the new SQL formatting mechanism the limit is bound by the maximum recursion limit in Python side. The purpose…
In previous versions the max size of a domain was bounded by psycopg memory limits. With the new SQL formatting mechanism the limit is bound by the maximum recursion limit in Python side. The purpose of this patch is to restore previous behavior.
In 16.0:
```
>>> def make_dom(N):
... return [*('|' for x in range(N-1)), *(('login', '=', 'admin') for x in range(N))]
...
>>> u.search(make_dom(9984))
res.users(2,)
>>> u.search(make_dom(9985))
Traceback (most recent call last):
File "<input>", line 1, in <module>
u.search(make_dom(9985))
File "/home/odoo/src/odoo/16.0/odoo/models.py", line 1520, in search
return res if count else self.browse(res)
File "/home/odoo/src/odoo/16.0/odoo/models.py", line 5140, in browse
if not ids:
File "/home/odoo/src/odoo/16.0/odoo/tools/query.py", line 217, in __bool__
return bool(self._result)
File "/home/odoo/src/odoo/16.0/odoo/tools/func.py", line 28, in __get__
value = self.fget(obj)
File "/home/odoo/src/odoo/16.0/odoo/tools/query.py", line 210, in _result
self._cr.execute(query_str, params)
File "/home/odoo/src/odoo/16.0/odoo/sql_db.py", line 321, in execute
res = self._obj.execute(query, params)
psycopg2.errors.SyntaxError: memory exhausted at or near ""login""
LINE 1: ...((("res_users"."login" = 'admin') OR ("res_users"."login" = ...
```
in 17.0 without this patch
```
>>> u.search(make_dom(1480))
res.users(2,)
>>> u.search(make_dom(1481))
<shortened output ...>
File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
child = stack[-1].send(child)
File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 86, in <genexpr>
if isinstance(child, SQL):
File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
child = stack[-1].send(child)
File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 86, in <genexpr>
if isinstance(child, SQL):
File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
child = stack[-1].send(child)
File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 86, in <genexpr>
if isinstance(child, SQL):
File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
child = stack[-1].send(child)
RecursionError: maximum recursion depth exceeded
```
This issue was observed in upgrades in multiple instances. Example: MRP produces an OR domain with 2K terms for warehouse sub-locations that fail.
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-prThis fix resolves a performance issue where copying multiple attachments (such as when sending mass mailings with multiple files) would cause the system to index every attachment individually, resulting in extremely slow or hanging operations. The update prevents unnecessary indexing during bulk attachment copying, significantly improving performance.
Original PR description
Description of the issue/feature this PR addresses: Current behavior before PR: The original fix was done here https://github.com/odoo/odoo/pull/99856, but when copying multiple attachments it failed For example in the case of a mass.mailing sending 2 attachments, indexes every attachment, taking forever and never finishing. Desired behavior after PR is merged: On copy of multiple attachment, avoid indexing every time --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#152219
This fix prevents customers from being charged multiple times when Adyen payment requests are retried due to system errors. By adding an idempotency key to payment requests, Adyen will recognize duplicate requests and only charge the customer once, even if Odoo retries the same payment multiple times.
Original PR description
Issue: When the notification webhook is enabled for Adyen, sometimes the response back causes an SQL concurrent update. Odoo then creates a retry towards Adyen, charging the customer card several…
Issue: When the notification webhook is enabled for Adyen, sometimes the response back causes an SQL concurrent update. Odoo then creates a retry towards Adyen, charging the customer card several times. Both the notification webhook and the payment controller are hit, and try updatingthe same row simultaneously, which causes this behavior. Steps to reproduce: This bug is not reproducible due to a connection issue for the Adyen test account. However, if the payment request would implement idempotency we could prevent billing the customer on the same request if the request reaches this collision and is retried multiple times. Description A first payment request is sent to Adyen. The card is charged and Adyen answers that all went as expected. We try to process the payment, but a concurrent access error occurs. A retry is done. A payment request is sent again to Adyen, The card is charged AGAIN and Adyen answers that all went as expected. We try to process the payment, but a concurrent access error occurs. For each retry, the request is sent and the card is charged. If the first retry succeeds, then Odoo can finish the process. There will be only 1 payment transaction on Odoo's side (others have been rollbacked) but there will be 3 on Adyen's side and the card will be charged 3 times. This PR fixes this behaviour by adding the idempotency key to the headers with the hash of the transaction reference and the database UUID, we prevent duplicate payments to happen. OPW-3584300 Forward-Port-Of: odoo/odoo#152760 Forward-Port-Of: odoo/odoo#150102