Daily updates from Odoo
Friday, February 23, 2024
23 changes · saas-17.1
Enhancements to existing features
This update restores the ability for users to directly edit expense lines within expense reports. This change improves usability and allows for more accurate reporting. Key fields like quantity and taxes remain readonly to prevent data inconsistencies.
Original PR description
In #138387 we modified the expense lines tree in expense reports so that the user can click on the lines to see an attached receipt in the viewer at the side of the webpage. The tree was made to be readonly to make clicking the lines easier and to make it harder for the user to change a field by mistake. This commit reverts the lines to being editable again while leaving some fields as readonly like quantity and taxes as those can invalidate the expense. Task link: https://www.odoo.com/web#model=project.task&id=3685651 task-3685651 Forward-Port-Of: odoo/odoo#149588
This update introduces an HSN (Harmonized System) code autocomplete widget for Odoo's Indonesian localization. Users can now quickly select HSN codes from a list as they enter data, streamlining the tax input process. This enhancement improves accuracy and efficiency for Indonesian businesses using Odoo.
Original PR description
- In this PR, we make some requests in js to get a list of HSN codes to match with the input entered by the user in the field. - And for the options attribute in hsn_autocomplete widget, when a user selects an option from the list, the hsn_decription will be stored in the field specified by the user. task-3646598 Forward-Port-Of: odoo/odoo#151507
This update adds a new test to ensure dropdown menus (like submenus) in Odoo are consistently and correctly tested across all versions. This improves the reliability of our software by verifying a key functionality, and helps prevent potential issues with navigation and user experience. This is a standard improvement for maintaining software quality.
Original PR description
This commit backports the test introduced in odoo/odoo#155154, as it is relevant to have it in every versions to ensure that dropdown menu (i.e. submenus) are correctly tested. 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#155156
Resolved issues and error corrections
This update resolves a performance issue that slowed down the process of adding new messages in Odoo. By optimizing how related data is calculated, the system now inserts messages approximately twice as fast, leading to a smoother user experience. This change primarily impacts the 'mail' module.
Original PR description
Move compute of `imStatusTrackedPersonas` to its inverse field. Doing the compute on the "One" side of the relation prevents from looping and computing all values whenever there is a change in any of them. In practice, this reduces the "compute" time of the message fetch (which also fetch persona as authors of messages), reducing by approximately half the time it takes to insert these messages (depending on the number of persona it had to loop through). For example from 60ms to 30ms on my machine for message insert in "partner_1_125" (populate medium). Forward-Port-Of: odoo/odoo#154918
This update resolves an issue where the system was incorrectly summing data returned from a key function. This fix ensures accurate calculations within the stock account module, improving data reliability. No immediate user impact is expected.
Original PR description
This commit fixes summing list of dicts returned by _prepare_analytic_lines. NB: This code is not yet covered by a test use case. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#152819
This update resolves a performance issue related to how Odoo reads activity deadlines. By batching the reading process, the system now handles deadlines more efficiently, leading to faster response times. This change ensures smoother operation for users managing activities and appointments.
Original PR description
`__getitem__()` of BaseModel, reset the prefetch set of the recordset. Fix _compute_activity_date_deadline, to batched the reading of activity's deadline. Forward-Port-Of: odoo/odoo#154728 Forward-Port-Of: odoo/odoo#154159
This update restores missing images after upgrading to version 17.0, preventing visual errors and crashes when using website snippets. A temporary workaround is implemented to ensure images display correctly until a permanent fix is applied in the upgrade repository.
Original PR description
Commit [1] introduced default images changes for the website library. The problem is that the ir.attachment definitions are in a non-updatable environment by mistake (apparently since forever)... so…
Commit [1] introduced default images changes for the website library. The problem is that the ir.attachment definitions are in a non-updatable environment by mistake (apparently since forever)... so they are not updated after update/upgrade. This commit moves the definitions to its own updatable file, in 17.0 and above only (ignoring potential other changes that were made in 15.0/16.0 at the time but apparently led to no issue). But this is not enough: upgraded users will still have those ir.attachment records marked as non updatable and will thus not be updated. Meaning that the ir.attachment record will still reference path to images that do not exist anymore (since [1]) and thus not display anything in related snippets, or worse: crash on some non-robust-to-404-images options (This will be made more robust in another update). Note that, at the moment, we cannot solve this issue by making the /web/image route not return a 404 but a placeholder image in that case, for technical reasons (even though it would be consistent as this is what is done if you try to reach `/web/image/something_with_a_typo`). It would also be annoying to solve this problem by adding a migration script inside the Odoo repo itself: - It would only work if upgraded users do a -u again (unlikely). - That would mean an upgrade script rotting in the main repo forever. Instead, this commit chose to restore the removed images so that upgraded users will be able to use the outdated paths. In master, an upgrade script will be made (in the upgrade repo) to properly update all those attachment records and be able to finally remove those outdated images. Note that this may also be fixed without upgrade script if non-updatable records whose XML declaration is moved out a non-updatable area become updatable (under discussion with the framework team... we will see when this lands in master). Steps to reproduce: - Install a 16.0 with the website module - Upgrade to 17.0 - Drag a "Blockquote" snippet on a page => Crash and the image is missing (in the DOM but invisible and impossible to edit). Note that the crash itself will also be fixed by the later update that will be done to make editor options more robust to 404 images. [1]: https://github.com/odoo/odoo/commit/a4377bfa85b19be29a430573e0f42fff4da52757 opw-3693055 opw-3723895 opw-3744257 opw-3747348 opw-3749764 ... Forward-Port-Of: odoo/odoo#155015
This update optimizes the way Odoo searches for channels, resulting in faster performance. The change avoids inefficient database queries and ensures accurate results. It also includes improvements to testing and security rules.
Original PR description
Part 1: _search_is_member ------------------------- Separate query to fetch candidate channels because the sub-select that `_search` would generate leads psql query plan to take bad decisions. When…
Part 1: _search_is_member ------------------------- Separate query to fetch candidate channels because the sub-select that `_search` would generate leads psql query plan to take bad decisions. When candidate ids are explicitly given it doesn't need to make (incorrect) guess, at the cost of one extra but fast query. It is expected to return hundreds of channels, a thousand at most, which is acceptable. A "join" would be ideal, but the ORM is currently not able to generate it from the domain. `sudo` is added as well because the rules for the member don't need to be checked as no information is leaked. Part 2: clean rules ------------------- The rule for reading "self" is included in the rule for reading other members. It can be disabled for "read" to avoid duplicate. It also checked is_member again, but is_self necessarily implies it. Part 3: clean tests ------------------- The opportunity is taken to fix the tests. The tests where considering as "access error" when there was an assert error inside the test (for example not finding the channel or the member), but those needed to be considered as failure regardless of expected outcome of access check. Extra mute loggers are added to clean the test output. Forward-Port-Of: odoo/odoo#153697
This update corrects a bug where validating a stock picking with available quantity would incorrectly pick an empty stock picking, preventing further reservations. The fix ensures that only pickings with actual stock are validated, maintaining accurate inventory management. This resolves an issue that could lead to incorrect stock levels.
Original PR description
Usecase to reproduce: - Create a picking with available quantity and another without - Confirm both picking - In list view, select the two picking and use the validate action Expected behavior: The first picking is validated and the second has been untouched Current behavior: The second picking is picked. That will prevent any further reservation It happens because on multiple records the error message for empty picking is bypassed and the picked is applied on it. Close #153983 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#155039
This update resolves an issue where base users were incorrectly denied access to their own expense reports. A technical oversight in the system's design prevented them from generating these reports, resulting in an access error. This fix ensures all users, including base users, can properly create and access their expense reports.
Original PR description
Have a base user with no access to Accounting, Expenses, Employee Create an expense, input an amount Save and Create Report Access Error will raise You are not allowed to access 'Journal Entry' (account.move) records. This occurs because of a remaining field in the hr.expense.sheet form view after refactoring the model opw-3690493 Forward-Port-Of: odoo/odoo#154798 Forward-Port-Of: odoo/odoo#152288
This update ensures that products with warning or blocking messages are clearly displayed in the product catalog when creating quotations. This prevents users from accidentally adding products with critical issues to their orders, improving order accuracy and reducing potential errors. The fix also extends to the purchase module.
Original PR description
Currently, when adding a product to a quotation with the catalog, no warning message will appear when adding a poduct that has a warning or blocking message. Steps to reproduce: ------------------- *…
Currently, when adding a product to a quotation with the catalog, no warning message will appear when adding a poduct that has a warning or blocking message.
Steps to reproduce:
-------------------
* Go to **Sales** app -> Configuration -> Settings
* Enable **Sale Warnings**
* Go to **Products** -> Products
* Create a new product
* Under **Sales** tab:
* For warning, select either warning or blocking message
* Write a message
* Go to **Orders** -> Quotations
* Create a new quotation
* Select the **Catalog** to add products
* Add the newly created product
Why the fix:
------------
The first version of this fix was a python exclusive change. It was a bit hacky; it was raising an error when the product had a blocking warning and sending a message on the bus when the product had a non-blocking warning.
The second version was changing the return value of `_update_order_line_info` to return the price and the warning if any. The warning was shown inside JS with `_updateQuantity`. This change was not good for a stable verion as it was changing the signature of a public method.
This fix automatically changes the data that is loaded to the catalog. It adds the warning message if any and changes the `readOnly` field accordingly.
Warning/blocking messages will be automatically displayed in the catalog, on the product informations. Products with blocking messages will me marked as readonly to avoid being able to add the product to the sale order (this is the original behavior for blocking messages).
Regarding the field `readOnly` and ẁarning`:
* We can't write `res[product.id]['readOnly'] = product.sale_line_warn == "block"' because readOnly is set to True by default if the sale order is cancelled and doing this would overide that value later. See:
https://github.com/odoo/odoo/blob/21c25a7ccd0ba2d6574ddbcfbcf50dbbc03a1e6c/addons/product/models/product_catalog_mixin.py#L97-L99
* We're also sending the warning only if there is one because of this:
```python
<span t-elif="props.readOnly" class="my-2 pt-3 border-top" t-out="props.warning">
You can't edit this product in the catalog.
</span>
```
Because in the case where readOnly is True for another reason than the product having a blocking warning, the initial message will be displyed.
Since the module purchase also uses the warning on products, this fix is extended to include it.
opw-3631511
Forward-Port-Of: odoo/odoo#149155This update resolves an issue where editing the 'Products' field in loyalty programs would clear the selections. The fix ensures that product selections made in the default loyalty rule are now saved correctly when the program is created or edited, improving the user experience for loyalty program setup.
Original PR description
**Current behavior:** Creating a promo type loyalty program and editing the 'products' field in the 'Among' section of the rule created by default at the bottom of the form view before saving the…
**Current behavior:**
Creating a promo type loyalty program and editing the
'products' field in the 'Among' section of the rule created by
default at the bottom of the form view before saving the
program will cause the products selected in this field to be
cleared upon saving the program.
**Expected behavior:**
Filling out this field of the default rule before saving the
overarching loyalty program should result in the same behavior
as doing so after saving the program. That is, the field should
save the user's input.
**Steps to reproduce:**
1. Create a new loyalty program in the Discount & Loyalty tab
2. Give it a name and, before saving the program, edit the
'Products' field of the default rule that is created at
the bottom of the form to have at least one value
3. Now save the program and observe that the 'Products' field
has been cleared of the previously selected values
**Cause of the issue:**
In the form view for the loyalty.program there are two
instances of the field trigger_product_ids which are set to be
invisible unless creating a specific program type. This field
is set to be related to rule_ids.product_ids in its definition
within the loyalty.program class definition. Thus, when the
user saves the program and rule concurrently, the empty
trigger_product_ids field overwrites the product_ids field
and whatever the user had populated it with is cleared.
The reason it only happens to the default rule and not ones
which are manually added before saving the program is because
in the traverse_related() method in fields.py, only the first
record of the related field is returned to be modified. In this
case, it means only the first rule's product_ids field is
overwritten.
**Fix:**
Overwrite the create() method in program.loyalty and check if
the program being created is of type 'gift_card' or 'ewallet'
then, if so, delete the trigger_product_ids key,val from the
dictionary so it will not later override the products specified
in the loyalty rule.
opw-3669953
Forward-Port-Of: odoo/odoo#150418This update resolves an issue that caused a 500 error when creating draft invoices with payment terms that include early discounts. The fix ensures the invoice preview function correctly calculates the total amount due, even when discounts are applied, preventing the error and improving invoice generation reliability.
Original PR description
Description of the issue this PR addresses: --- On obtains a 500: Internal Server Error when creating an invoice with a 2 lines payment term. Error while rendering the template…
Description of the issue this PR addresses: --- On obtains a 500: Internal Server Error when creating an invoice with a 2 lines payment term. Error while rendering the template "account.report_invoice_document". Steps to reproduce: --- - Accounting > Configuration > invoicing > Payment Terms - New > Create and save a payment term with 2 lines: - name 80/20 test - line_1 : 80% after 0 days - line_2 : 20% after 30 days - Sales > Orders > Quotations - Chose any > use payment terms 80/20 test - Save and create associated invoice > chose regular invoice - Create draft invoice > preview > 500: Internal Server Error Cause of the issue: --- The method "_get_amount_due_after_discount" called during the rendering of the template does not return a value in case self.early_discount is False. Fix: --- Return total_amount by default since no discount is applied. opw-3683708 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#149934
This update corrects a bug that prevented users from saving accrual level configurations. The issue stemmed from a technical limitation with a field's read-only status, which was incorrectly preventing data entry. The fix ensures the field can be properly updated, allowing for accurate holiday accrual planning.
Original PR description
Steps to reproduce: ------------------- - create an accrual plan; - create an accrual level; - save; - create a second accrual level; - save the form; Issue: ------ We trigger an error with an…
Steps to reproduce: ------------------- - create an accrual plan; - create an accrual level; - save; - create a second accrual level; - save the form; Issue: ------ We trigger an error with an invalid `added_value_type` field. Cause: ------ The `added_value_type` is a compute stored field without inverse. As it is not inversible, this field will be readonly by default [^1]. When the dialog window is opened, we trigger a specific logic which will trigger an onchange [^2]. During this onchange, we work with a virtual record from the `hr.leave.accrual.level` model (the one corresponding to the first level) which has an origin. Unfortunately, we are using the cached value for the virtual record, i.e. `None`. The latter will have been set as if it is a record without origin. As the `added_value_type` field is readonly on the dialog form view, we have to save the record with this value. Since this field is required, the error occurs. Solution: --------- In order to use the value on the original record, the field must be forced with `readonly=False`. Note: ----- Commit which introduced the issue: 0a9e83dfd81300fd1204693cf6d4dca2bab40b2c The fix allows you not to use `_origin` (which normally shouldn't be used in this case). [^1]: https://github.com/odoo/odoo/blob/e89ed59269974f148c2285446dcd60e871df1a01/odoo/fields.py#L451 [^2]: https://github.com/odoo/odoo/blob/25cda065dccaae5edd861114c29157c7abb68533/addons/web/static/src/model/relational_model/static_list.js#L194-L299 opw-3745463 Forward-Port-Of: odoo/odoo#155033
This update quietly resolves a warning message that appeared after importing new modules into Odoo. Previously, the system attempted to update its internal graph, which was unnecessary and caused the warning. This change ensures a smoother import process without disrupting the user experience.
Original PR description
Before this PR, after having imported a module, a warning appears in the log, because it tries to update the graph which does not make sense for an imported module. This commit makes sure the warning is skipped if the module was imported. This commit can be backported to previous versions, if useful. Forward-Port-Of: odoo/odoo#155096
This update corrects a technical error preventing users from successfully verifying a partner's Peppol endpoint. The previous issue caused a system error, blocking the verification process. This fix ensures the Peppol verification feature functions correctly for all partners.
Original PR description
### Steps to reproduce * install `account_peppol` * open a partner's list view * select a contact * on the top middle, click Actions > Verify Peppol You should be met with a traceback: `AttributeError: 'bool' object has no attribute 'setdefault'` ### Cause `button_account_peppol_check_partner_endpoint` is expected to return an action or a falsy value (no action to perform). opw-3683612 Forward-Port-Of: odoo/odoo#152817
This update fixes an issue where the 'Secured by' label was hidden for payment methods when the payment_custom or payment_demo modules were installed. The change removes a technical workaround and now correctly displays the payment provider for all payment methods, enhancing transparency and security for users.
Original PR description
If payment_custom or payment_demo is installed 'Secured by' element is overriden and becomes hidden for all payment providers. We removed xpath as it is more convenient for the users to see which provider is behind a payment method. After this commit 'Secured by' element is shown for all providers except for custom. Proper fix is available in master - https://github.com/odoo/odoo/pull/154985 Forward-Port-Of: odoo/odoo#155014
This update corrects a technical issue where translations weren't loading properly in Odoo. The team re-exported missing comments from .pot files, ensuring that translations are correctly identified and displayed for various Odoo add-ons. This improves the user experience for international customers.
Original PR description
odoo-python and odoo-javascript comments in .pot files are used to determine which translations to load. Omitting them would cause the translations not to appear. This commit goes through all .pot files and re-exports the ones where the comments have been omitted. Task-3764933. Enterprise: https://github.com/odoo/enterprise/pull/57361
This update resolves an issue where users lacked the ability to create new records with property fields if they didn't have access to the related parent record. The fix utilizes a temporary 'sudo' call to bypass access restrictions, ensuring all users can now create records with default property values.
Original PR description
When the user creates a new record having a property field, the system fetches the property definition of the parent record to retrieve the field's default values (see: `_add_default_values`). If the user lacks read access on the parent record, the user gets an access error when retrieving the property definition of the parent record. To prevent this error, we will perform a sudo call on the parent record before reading the property definition of the parent record. This allow the user to create a new record, even if they do not have access to the parent record. task-3594814 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#154651 Forward-Port-Of: odoo/odoo#146265
This update stops Odoo from automatically sending emails when a validation token is assigned to an order. Previously, this created extra notifications that weren't essential for business operations. This change improves system performance and reduces unnecessary email volume.
Original PR description
Before this commit, validation transactions would send an email when the token is assigned to the order. taskid: 3675875 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#154650 Forward-Port-Of: odoo/odoo#151773
This update resolves an issue preventing the generation of QR codes on Saudi invoices when submitting multiple documents simultaneously. The problem stemmed from how Odoo calculates computed fields in batch processes, leading to an error when attempting to generate QR codes for related invoices. This fix ensures QR codes are correctly generated for Saudi invoices.
Original PR description
### Steps to reproduce * install `l10n_sa_edi` * switch to a Saudi company * deactivate the "EDI : Perform web services operations" scheduled action. (this will help ease the reproduction process) *…
### Steps to reproduce * install `l10n_sa_edi` * switch to a Saudi company * deactivate the "EDI : Perform web services operations" scheduled action. (this will help ease the reproduction process) * create and post two invoices for a partner that's an individual (not a company) * manually run that scheduled action. You should be met with a traceback. ### Cause When a ZATCA document is submitted, the system performs several operations, two of which are important for this issue: 1. Generating a signature (`l10n_sa_invoice_signature`) 2. Using this signature to generate a QR code (`l10n_sa_qr_code_str`) The QR code generation relies on the assumption that the signature (`l10n_sa_invoice_signature`) already exists, which is a reasonable expectation as the signature is typically created prior to the QR code. However, complications arise when multiple documents are submitted simultaneously in a batch process. During batch processing, each document in the batch undergoes the same two operations mentioned above. The issue emerges due to the behavior of non-stored computed fields. In Odoo, computed fields are evaluated in batches, meaning that if you access a computed field for one record, Odoo may also compute the same field for other records fetched in the same operation. For example, if you have two records, `A` and `B` such that `B.id in A._prefetch_ids`, and you access a computed field on `A`, Odoo will also compute this field for `B` at the same time. This behavior leads to an issue when submitting two documents (`D1` and `D2`) together. The system will generate a signature and then compute the QR code for `D1`. However, when computing the QR code for `D1`, it inadvertently attempts to also compute the QR code for `D2` due to the batch computation behavior. Since `D2`'s signature has not yet been generated at this point, this results in an error. opw-3696146 Forward-Port-Of: odoo/odoo#153810
This update significantly speeds up the opening of the messaging menu in Odoo. By caching key calculations and reducing unnecessary data access, the menu now loads much faster, especially after the initial opening. This enhances the user experience and improves responsiveness.
Original PR description
Slight speed improvement initially, good improvement especially for subsequent openings. See individual commits. On my machine, with populate medium. Duration of the different calls to sort (the most problematic method) during opening: Before: 150ms, 165ms, 141ms After: 118ms, 50ms, 40ms Forward-Port-Of: odoo/odoo#155068
This update fixes a potential issue where changing a company in Odoo could cause problems with existing financial transactions. The change ensures that transactions remain associated with their original company, maintaining data integrity and preventing errors. This improves the stability and reliability of the payment system.
Original PR description
opw-3696841 Forward-Port-Of: odoo/odoo#155113