Thursday, November 28, 2024
22 changes · saas-17.2
Resolved issues and error corrections
A test in the Sales Project area was corrected so it checks the intended result instead of passing accidentally. This improves confidence that future changes to project milestone forms are validated properly before release.
Original PR description
Currently, the assert function returns undefined, which is why this test case is passing. However, assert always returns undefined, regardless of whether the value satisfies the condition or not. task-4354290
Miscellaneous changes
The query in `_get_invoice_matching_so_candidates` will frequently plan a Seq Scan because of the low selectivity of the conditions. And when it does not, the number of rows returned by the CTE is expected to high. Because of that, filtering the resulting rows by a sequence of `OR` conditions can quickly become slow. In this commit, the `OR` conditions are replaced by `LIKE(ANY(ARRAY[]))` conditions. That way the CTE is only referenced once in the conditions and applying the filter on each ro
Original PR description
The query in `_get_invoice_matching_so_candidates` will frequently plan a Seq Scan because of the low selectivity of the conditions. And when it does not, the number of rows returned by the CTE is…
The query in `_get_invoice_matching_so_candidates` will frequently plan a Seq Scan because of the low selectivity of the conditions. And when it does not, the number of rows returned by the CTE is expected to high. Because of that, filtering the resulting rows by a sequence of `OR` conditions can quickly become slow. In this commit, the `OR` conditions are replaced by `LIKE(ANY(ARRAY[]))` conditions. That way the CTE is only referenced once in the conditions and applying the filter on each row is way faster. We also discarded duplicated `text_tokens` to reduce the size of the `ARRAY`. The reason why using a `LIKE(ANY(ARRAY[]))` is faster is because postgres inlines the CTE in the outer query. This means that it performs a Seq Scan on sale.order and injects the CTE definition of sub.name inside the `WHERE` conditions of the outer query, along with injecting the `WHERE` conditions of the CTE. So, the regex functions are distributed among the `OR` conditions. I.e. every `OR` condition left operand will contain the regex functions. As those have to be executed for every `OR` condition, this quickly becomes slow. We can explicitely materialize the CTE to avoid that. This makes postgres evaluate the regex functions only once. But it will still have lots of `OR` conditions to check along with running pattern matching for each one of them. `LIKE(ANY(ARRAY[]))` avoids this issue. The CTE is still inlined but since we now only have a single condition, the regex functions are only evaluated once and pattern matched once against an array of options. This makes the whole query faster and scale better. #### speedup Customer database with 808341 sale.orders. Query timing when increasing the number of text tokens. | Number of tokens | Before PR | After PR | |:-------------------:|:----------:|:--------:| | 2 | 7s | 1.3s | | 5 | 10s | 1.3s | | 10 | 18s | 1.4s | | 20 | 33s | 1.55s | opw-4329067 opw-4316765 Forward-Port-Of: odoo/enterprise#73755
Fix validation to ensure the CFDI origin field is assigned properly. Prevents cases like `04|`, ensuring the UUID is correctly validated. Before: `{'tipo_relacion': '04', 'cfdi_relationado_list': ['']}` After: `{'tipo_relacion': '04', 'cfdi_relationado_list': []}` Forward-Port-Of: odoo/enterprise#74226
Original PR description
Fix validation to ensure the CFDI origin field is assigned properly. Prevents cases like `04|`, ensuring the UUID is correctly validated.
Before:
`{'tipo_relacion': '04', 'cfdi_relationado_list': ['']}`
After:
`{'tipo_relacion': '04', 'cfdi_relationado_list': []}`
Forward-Port-Of: odoo/enterprise#74226### Steps to reproduce: - In Accounting Dashboard, click on "import file" in the Bank kanban box - Select a CSV file with two missing values on a line, for example: ``` Transaction Type,Bank Reference,Narrative,Debit Amount,Credit Amount TRANSFER,bank_ref_1,bank_statement_line_1,,1000 TRANSFER,,bank_statement_line_2,,3500 ``` (missing `bank_ref_2`) - Complete the Odoo fields: Transaction Type, Reference, Label, Debit, Credit - Import - Go in Accounting Dashboard > Bank Reconciliation
Original PR description
### Steps to reproduce: - In Accounting Dashboard, click on "import file" in the Bank kanban box - Select a CSV file with two missing values on a line, for example: ``` Transaction Type,Bank…
### Steps to reproduce: - In Accounting Dashboard, click on "import file" in the Bank kanban box - Select a CSV file with two missing values on a line, for example: ``` Transaction Type,Bank Reference,Narrative,Debit Amount,Credit Amount TRANSFER,bank_ref_1,bank_statement_line_1,,1000 TRANSFER,,bank_statement_line_2,,3500 ``` (missing `bank_ref_2`) - Complete the Odoo fields: Transaction Type, Reference, Label, Debit, Credit - Import - Go in Accounting Dashboard > Bank Reconciliation and select the list view - `bank_statement_line_2` appears in Reference instead of Label ### Cause: In `_parse_import_data` some line values are added and some are expected to be removed. The values expected to be removed are stored by index but they are removed by value. In this case the index supposed to be removed is 3 but its value is empty like index 1. On the line `line.remove(line[index])` the first occurrence is removed, so index 1 is removed instead of 3. ### Solution: Use `del` to remove by index. opw-4319464 Forward-Port-Of: odoo/enterprise#74512
The module description of `account_sepa_direct_debit` in the manifest states that posting an invoice will automatically generate a payment. Actually that feature was dropped in Odoo 13 with commit e3d390c4455c620793c481874b4503fa91bb6125 but the `__manifest__.py` was not updated at that time. This makes the situation uncomfortable where a feature not present in the code is still advertised in the module description. This commit updates the description of the module in the manifest. Forward-P
Original PR description
The module description of `account_sepa_direct_debit` in the manifest states that posting an invoice will automatically generate a payment. Actually that feature was dropped in Odoo 13 with commit e3d390c4455c620793c481874b4503fa91bb6125 but the `__manifest__.py` was not updated at that time. This makes the situation uncomfortable where a feature not present in the code is still advertised in the module description. This commit updates the description of the module in the manifest. Forward-Port-Of: odoo/enterprise#74532 Forward-Port-Of: odoo/enterprise#73380
Currently the view has the default priority and become the main search view for product despite being specific to industry_fsm_sale. It creates issues in inventory at date view where the filters doesn't exist due to this. Forward-Port-Of: odoo/enterprise#74600
Original PR description
Currently the view has the default priority and become the main search view for product despite being specific to industry_fsm_sale. It creates issues in inventory at date view where the filters doesn't exist due to this. Forward-Port-Of: odoo/enterprise#74600
Since `xlrd >= 2.0` dropped XLSX support, we use `openpyxl` to open XLSX files if the `xlrd >= 2.0` is installed.[^1] However, the tests in `account_base_import` are skipped unless `xlrd.xlsx` can be imported. As a result, they are not run on runbot, where `xlrd >= 2.0` is installed. We therefore need to avoid skipping them if openpyxl is installed. runbot-108001 [^1]: https://github.com/odoo/odoo/pull/169245 Forward-Port-Of: odoo/enterprise#74608
Original PR description
Since `xlrd >= 2.0` dropped XLSX support, we use `openpyxl` to open XLSX files if the `xlrd >= 2.0` is installed.[^1] However, the tests in `account_base_import` are skipped unless `xlrd.xlsx` can be imported. As a result, they are not run on runbot, where `xlrd >= 2.0` is installed. We therefore need to avoid skipping them if openpyxl is installed. runbot-108001 [^1]: https://github.com/odoo/odoo/pull/169245 Forward-Port-Of: odoo/enterprise#74608
Problem: ======== when using pacs : Quadrum, SW Sapien some clients get their CFDI rejected because the schemaLocation is is containing more headers than needed. Solution: ========= We will only keep the needed schemaLocation for customer invoice, so headers for Payment and External Trade will be removed. opw-4168509 Forward-Port-Of: odoo/enterprise#74402 Forward-Port-Of: odoo/enterprise#72450
Original PR description
Problem: ======== when using pacs : Quadrum, SW Sapien some clients get their CFDI rejected because the schemaLocation is is containing more headers than needed. Solution: ========= We will only keep the needed schemaLocation for customer invoice, so headers for Payment and External Trade will be removed. opw-4168509 Forward-Port-Of: odoo/enterprise#74402 Forward-Port-Of: odoo/enterprise#72450
Currently, an error occurs when the user attempts to preview an invoice, and invoice date is not available. Step to produce: - Install the ```account``` module. - Create a new invoice, add a customer name and invoice line, and add a 'Payment Terms' which have an 'Early Discount' available. - 'Cancel' this invoice. - Click on the 'Preview' button (ensure that the invoice has no date). ```TypeError: unsupported operand type(s) for +: 'bool' and 'relativedelta'``` An error occurs whe
Original PR description
Currently, an error occurs when the user attempts to preview an invoice, and invoice date is not available. Step to produce: - Install the ```account``` module. - Create a new invoice, add a customer name and invoice line, and add a 'Payment Terms' which have an 'Early Discount' available. - 'Cancel' this invoice. - Click on the 'Preview' button (ensure that the invoice has no date). ```TypeError: unsupported operand type(s) for +: 'bool' and 'relativedelta'``` An error occurs when the system attempts to calculate the discount days with the invoice date, but the invoice date is not available there. To resolve this issue, we hide the preview button on canceled invoices. Sentry-6006569495 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#188134 Forward-Port-Of: odoo/odoo#184817
Description of the issue/feature this PR addresses: This PR adds the signed corporate Contributor License Agreement (CLA) for Xcellent Exchange, allowing contributions from our organization to the Odoo repository in compliance with Odoo's contribution policies. Current behavior before PR: Contributions from Xcellent Exchange are not formally recognized due to the absence of a signed CLA in the Odoo repository. Desired behavior after PR is merged: The signed corporate CLA for Xcellent Ex
Original PR description
Description of the issue/feature this PR addresses: This PR adds the signed corporate Contributor License Agreement (CLA) for Xcellent Exchange, allowing contributions from our organization to the Odoo repository in compliance with Odoo's contribution policies. Current behavior before PR: Contributions from Xcellent Exchange are not formally recognized due to the absence of a signed CLA in the Odoo repository. Desired behavior after PR is merged: The signed corporate CLA for Xcellent Exchange is added to the Odoo repository. Contributions from Xcellent Exchange can be properly acknowledged and merged. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#188672
Install mass-mailing and crm. Change the email address of Brandon to a@example.com;b@example.com. In the list view of crm, add the select all leads and change their customer to Brandon (the customer column is not displayed by default, just make it visible). Create a new mass-mailing with the recipient list as "Lead/Opportunity". Start the campaign. Brandon receives as many emails as there are leads but he shall only receive one. The system has a known limitation when it comes to filtering dup
Original PR description
Install mass-mailing and crm. Change the email address of Brandon to a@example.com;b@example.com. In the list view of crm, add the select all leads and change their customer to Brandon (the customer…
Install mass-mailing and crm. Change the email address of Brandon to a@example.com;b@example.com. In the list view of crm, add the select all leads and change their customer to Brandon (the customer column is not displayed by default, just make it visible). Create a new mass-mailing with the recipient list as "Lead/Opportunity". Start the campaign. Brandon receives as many emails as there are leads but he shall only receive one. The system has a known limitation when it comes to filtering duplicates: it skips all records that have multiple recipients. In this case Brandon has two: [a@example.com](mailto:a@example.com) and [b@example.com](mailto:b@example.com). The de-duplication mechanism was skipped for every lead he was the customer of and each time a new email was sent, spamming him. In this work we make it possible to also process records with multiple recipients. It is a best-effort and will still let some duplicates through. Nonetheless it solves the current problem with minimal changes. Note: any([]) and any(['']) are both False while all([]) is True, hence we now check for empty list / empty email first otherwise an empty list would be considered to be opt-out instead of empty. Task-3927361 Forward-Port-Of: odoo/odoo#186799 Forward-Port-Of: odoo/odoo#186149
Raise an error when the user tries to load syscebnl template the same way we block syscohada, as those templates should not be used directly. chart added in https://github.com/odoo/odoo/pull/166211 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#187274
Original PR description
Raise an error when the user tries to load syscebnl template the same way we block syscohada, as those templates should not be used directly. chart added in https://github.com/odoo/odoo/pull/166211 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#187274
Introduced in #57155 (commit da29586). Steps to reproduce: - Install Odoo on a Windows machine - The install path defaults to Program Files as expected - Uninstall Odoo - Try to install Odoo again - The install path defaults to the empty string, forcing the user to manually set one Expected behaviour: - The install path defaults to the previous install path task-4104451 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-O
Original PR description
Introduced in #57155 (commit da29586). Steps to reproduce: - Install Odoo on a Windows machine - The install path defaults to Program Files as expected - Uninstall Odoo - Try to install Odoo again - The install path defaults to the empty string, forcing the user to manually set one Expected behaviour: - The install path defaults to the previous install path task-4104451 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#188637
If we replace the original definition then the check between the existing definition and the original one will always fail, thus we are always removing and re-adding the same constraint. https://github.com/odoo/odoo/blob/5ba361ddffa757cf60968f37180c7fd1304b3fd4/odoo/models.py#L3209 Replacing `%` by `%%` works for `LIKE` operator because they are equivalent. Since they are sent as-is to the DB the constraint could actually be plainly wrong. ```sql test_17=> SELECT coalesce(d.description, p
Original PR description
If we replace the original definition then the check between the existing definition and the original one will always fail, thus we are always removing and re-adding the same constraint.…
If we replace the original definition then the check between the existing definition and the original one will always fail, thus we are always removing and re-adding the same constraint. https://github.com/odoo/odoo/blob/5ba361ddffa757cf60968f37180c7fd1304b3fd4/odoo/models.py#L3209
Replacing `%` by `%%` works for `LIKE` operator because they are equivalent. Since they are sent as-is to the DB the constraint could actually be plainly wrong.
```sql
test_17=> SELECT coalesce(d.description, pg_get_constraintdef(c.oid))
FROM pg_constraint c
JOIN pg_class t
ON t.oid = c.conrelid
LEFT JOIN pg_description d
ON c.oid = d.objoid
WHERE t.relname = 'ir_model_fields'
AND conname = 'ir_model_fields_name_manual_field'
+------------------------------------------------+
| coalesce |
|------------------------------------------------|
| CHECK (state != 'manual' OR name LIKE 'x\_%%') |
+------------------------------------------------+
```
Example where the definition sent to the DB is wrong:
```py
class A(models.Model):
_inherit = "res.users"
_sql_constraints = [("test_constraint", "CHECK (login !~ '%')", "Cannot have % in login")]
```
```sql
test_17=> \d res_users
...
Check constraints:
"res_users_test_constraint" CHECK (login::text !~ '%%'::text)
...
```
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#188593In the domain selector (and expression editor), using autocompletion to build conditions for X2many fields will use their domains. Note that it cannot be done for a field many2one since values can be created outside of the field domain in that case. Forward-Port-Of: odoo/odoo#187740
Original PR description
In the domain selector (and expression editor), using autocompletion to build conditions for X2many fields will use their domains. Note that it cannot be done for a field many2one since values can be created outside of the field domain in that case. Forward-Port-Of: odoo/odoo#187740
This commit fixes the blank page when we print documents with PDF.js. It seems that pdf.js lib won't fix it because it's platform specific. We first try to fix this issue by hiding the "Download" and "Print" buttons as you can see in [1] but in this case, it's the only way to be able to dowload or print the document. So we patched the lib with the fix given inside the thread issue [2]. Steps to reproduce: - Open Odoo on the Android mobile App - Go to "Shop Floor" - Click on 'WH/
Original PR description
This commit fixes the blank page when we print documents with PDF.js. It seems that pdf.js lib won't fix it because it's platform specific. We first try to fix this issue by hiding the "Download" and "Print" buttons as you can see in [1] but in this case, it's the only way to be able to dowload or print the document. So we patched the lib with the fix given inside the thread issue [2]. Steps to reproduce: - Open Odoo on the Android mobile App - Go to "Shop Floor" - Click on 'WH/MO/00003' > 'Assembly 1' > 'Worksheet' - Click the print button on pdf.js toolbar => blank screen opw-4190135 [1]: https://github.com/odoo/odoo/commit/8a755d58330218b550efc0fea2f98800151c09a5 [2]: https://github.com/mozilla/pdf.js/issues/10630#issuecomment-855754913 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#188650
Currently, an error occurs when splitting a backorder of MO's. Step to produce: - Install the 'mrp' module. - Enable work orders in the settings. - Create a BOM for a product P with an operation: - OP1: Assembly line 1, duration 10 minutes. - Create and confirm an MO for 5 units of P. - Add a Work Center and Operation in the work order line. - Set a producing quantity of 2. - Validate the MO and create a backorder. - Open a backorder of MO, Select a backorder that is in a confirmed
Original PR description
Currently, an error occurs when splitting a backorder of MO's. Step to produce: - Install the 'mrp' module. - Enable work orders in the settings. - Create a BOM for a product P with an operation: -…
Currently, an error occurs when splitting a backorder of MO's.
Step to produce:
- Install the 'mrp' module.
- Enable work orders in the settings.
- Create a BOM for a product P with an operation: - OP1: Assembly line 1, duration 10 minutes.
- Create and confirm an MO for 5 units of P.
- Add a Work Center and Operation in the work order line.
- Set a producing quantity of 2.
- Validate the MO and create a backorder.
- Open a backorder of MO, Select a backorder that is in a confirmed state.
- Click on the 'Action' button to split a backorder into two productions.
See Traceback:
```
TypeError: argument of type 'NoneType' is not iterable
File "odoo/http.py", line 2363, in __call__
response = request._serve_db()
File "odoo/http.py", line 1891, in _serve_db
return self._transactioning(
File "odoo/http.py", line 1954, in _transactioning
return service_model.retrying(func, env=self.env)
File "odoo/service/model.py", line 137, in retrying
result = func()
File "odoo/http.py", line 1921, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2168, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 329, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 727, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 40, in call_button
action = call_kw(request.env[model], method, args, kwargs)
File "odoo/api.py", line 517, in call_kw
result = getattr(recs, name)(*args, **kwargs)
File "addons/mrp/wizard/mrp_batch_produce.py", line 59, in action_done
return self._production_text_to_object(mark_done=True)
File "addons/mrp/wizard/mrp_batch_produce.py", line 90, in _production_text_to_object
productions = self.production_id._split_productions({self.production_id: productions_amount})
File "home/odoo/src/enterprise/18.0/mrp_workorder/models/mrp_production.py", line 87, in _split_productions
productions = super()._split_productions(amounts=amounts, cancel_remaining_qty=cancel_remaining_qty, set_consumed_qty=set_consumed_qty)
File "addons/mrp/models/mrp_production.py", line 1996, in _split_productions
if workorder.production_id.id not in self.env.context.get('mo_ids_to_backorder', []):
```
An error occurs because the system retrieves a None value for 'mo_ids_to_backorder' from the context at [1], which is not iterable. This causes issues as an iterable value is expected.
Link [1]: https://github.com/odoo/odoo/blob/99e2b13416256a0a23a1a619b92873bcfe15b8a9/addons/mrp/models/mrp_production.py#L1846
To resolve this issue, provide an empty list
for 'mo_ids_to_backorder' if the retrieved value is None instead of an iterable.
Sentry-6080156727
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#188434Forward-Port-Of: odoo/odoo#188632
Original PR description
Forward-Port-Of: odoo/odoo#188632
Backport of PR odoo/odoo#182407 for 17.0. The major difference is the removal of the batching of `orderpoint._qty_in_progress` and the removal of the check on the inter-company location as this was only introduced in 17.4. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#183964
Original PR description
Backport of PR odoo/odoo#182407 for 17.0. The major difference is the removal of the batching of `orderpoint._qty_in_progress` and the removal of the check on the inter-company location as this was only introduced in 17.4. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#183964
Revert the following fix: https://github.com/odoo/odoo/commit/5e3b471f4a67553d6f7525595b15dc3d7b4efb3f Which is no longer necessary since we have streams: https://github.com/odoo/odoo/commit/da8def8e410de68256ba4ab09ebf7a8b699355ac In particular, media must be returned with code 206 and a range, which is now the case. Forward-Port-Of: odoo/odoo#188887 Forward-Port-Of: odoo/odoo#188872
Original PR description
Revert the following fix: https://github.com/odoo/odoo/commit/5e3b471f4a67553d6f7525595b15dc3d7b4efb3f Which is no longer necessary since we have streams: https://github.com/odoo/odoo/commit/da8def8e410de68256ba4ab09ebf7a8b699355ac In particular, media must be returned with code 206 and a range, which is now the case. Forward-Port-Of: odoo/odoo#188887 Forward-Port-Of: odoo/odoo#188872
### Steps to reproduce: - Create two alias domains - Create a Helpdesk team with alias name 'test' for example and with one of the alias domains created in the first step - Create another helpdesk team with the same alias name but with the other alias domain created in the first step - Notice the 'Invalid operation' pop-up that will be shown ### Current behavior before PR: This is happening because when creating the helpdesk team we should get the alias creation values but when getti
Original PR description
### Steps to reproduce: - Create two alias domains - Create a Helpdesk team with alias name 'test' for example and with one of the alias domains created in the first step - Create another helpdesk team with the same alias name but with the other alias domain created in the first step - Notice the 'Invalid operation' pop-up that will be shown ### Current behavior before PR: This is happening because when creating the helpdesk team we should get the alias creation values but when getting those values we are passing a default value for the alias_domain_id in the context https://github.com/odoo/odoo/blob/17.0/addons/mail/models/mail_alias_mixin_optional.py#L70:L72 which change the alias_domain_id value that will be used for the helpdesk team creation. ### Desired behavior after PR is merged: We are checking if the alias_domain_id is present in the vals_list or not and if it does exist we don't change it. opw-4286060 Forward-Port-Of: odoo/odoo#186474
When the write is called with multiple companies (like the test TestAccountComposerPerformance), the values are updated with the values of the very first company. This will write a new peppol_endpoint on all companies. However, in this test, the very first company is a BE one but another is FR. Then, this write makes an inconsistency between the original FR EAS and the new BE endpoint. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of:
Original PR description
When the write is called with multiple companies (like the test TestAccountComposerPerformance), the values are updated with the values of the very first company. This will write a new peppol_endpoint on all companies. However, in this test, the very first company is a BE one but another is FR. Then, this write makes an inconsistency between the original FR EAS and the new BE endpoint. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#188985