Thursday, July 25, 2024
3 changes · saas-17.3
Resolved issues and error corrections
This update fixes an internal test issue for website tooltips by waiting for scheduled actions in a more reliable way. It helps reduce false build failures, improving confidence in release checks without changing customer-facing behavior.
Original PR description
Use runAllTimers to wait the timeouts instead of a hardcoded time. Build error: 66010291 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Miscellaneous changes
Current Behavior: Computation of the field `pos_order_count` on model `loyalty.program` is slow when there is a large number of `pos.order.line` records with `reward_id` set on them. Cause of the issue: The list comprehension done here --> https://github.com/odoo/odoo/blob/27ff3e0f64f53caa62c3022bd3b7c41e29a8e721/addons/pos_loyalty/models/loyalty_program.py#L59 The complexity is `O(len(self) * ((len(read_group_res) * len(program_reward_ids)) + len(read_group_res<sum method>)))` which pe
Original PR description
Current Behavior: Computation of the field `pos_order_count` on model `loyalty.program` is slow when there is a large number of `pos.order.line` records with `reward_id` set on them. Cause of the…
Current Behavior: Computation of the field `pos_order_count` on model `loyalty.program` is slow when there is a large number of `pos.order.line` records with `reward_id` set on them. Cause of the issue: The list comprehension done here --> https://github.com/odoo/odoo/blob/27ff3e0f64f53caa62c3022bd3b7c41e29a8e721/addons/pos_loyalty/models/loyalty_program.py#L59 The complexity is `O(len(self) * ((len(read_group_res) * len(program_reward_ids)) + len(read_group_res<sum method>)))` which performs slowly if the `self` and `read_group_res` are large. Improvement: Delegate the computation to Postgres and assign the values obtained from the result. Benchmark: In method `_compute_pos_order_count` Number of `pos.order.line` records eligible in computation --> 17803 Where `self` is a a `loyalty.program` recordset len(self)| Before (in seconds) | After PR (in seconds) | |---------|--------|--------| |1000| 177.28 s | 6.43 s | |212| 29.73 s| 0.5 s | Improvement by about 98% on average opw-3903159 Forward-Port-Of: odoo/odoo#172394 Forward-Port-Of: odoo/odoo#167386
Summary ----- In the method load in models.py, when there is an error when we try to create a recordset with at least 2 records, we try to create each record separately. Only the errors caught by creating these single records are displayed which is confusing. Steps to Reproduce ----- 1. In Accounting > Configuration > Accounting > Chart of Accounts, create an account with the type "Off-Balanced Sheet" 2. On the same page, import a Chart of Account (import journal items
Original PR description
Summary ----- In the method load in models.py, when there is an error when we try to create a recordset with at least 2 records, we try to create each record separately. Only the errors caught by…
Summary
-----
In the method load in models.py, when there is an error when we try to create a recordset with at least 2 records, we try to create each record separately.
Only the errors caught by creating these single records are displayed which is confusing.
Steps to Reproduce
-----
1. In Accounting > Configuration > Accounting > Chart of
Accounts, create an account with the type "Off-Balanced Sheet"
2. On the same page, import a Chart of Account (import journal
items) by uploading a file which contains the following lines
(example available on the ticket):
[
['move_id','account_id','balance' 'journal_id','date'],
[<move_name>,<account_code_1>,1,<journal_name>,2021-01-01],
[<move_name>,<account_code_2>,-1,<journal_name>,2021-01-01]
]
such that:
- move_name cannot exist
account_code_1 is the code of the created account at
first step
account_code_2 is not the code of an account with the
type "Off-Balanced Sheet"
- journal_name is the name of an existing journal
3. Test or import the uploaded file and see the error which does
not mention the "Off-Balanced Sheet" account.
Cause
-----
If a journal entry contains a line with an "Off
Balanced Sheet" account, then all the other lines must have an account with the same type.
So when we try to load the lines of the uploaded file, it raises a UserError which is caught (which is not added to the list 'messages'). Then we try to create the lines one by one which and that raises an error too because the balance is not null.
Only these errors are added to the list 'messages' which contains the displayed error messages.
Fix
-----
Add the first error to 'message', and ensure that the next errors are not already in 'messages'.
opw-3945687
Forward-Port-Of: odoo/odoo#169083