Wednesday, August 7, 2024
34 changes · saas-17.4
Enhancements to existing features
The employee login screen in Point of Sale now shows date and time in the updated format introduced by recent login screen changes. Unused image assets were also removed, helping keep the module cleaner without changing core workflows.
Original PR description
This commit follows what have been done in https://github.com/odoo/odoo/pull/165956. It adapts the date and time format on the login screen. It also removes the unused images. task-id: 4047473 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Resolved issues and error corrections
Fixes an error that occurred when staff entered a coupon or gift card code in Point of Sale before adding any items to the cart. This helps cashiers apply customer promotions smoothly without interrupting checkout.
Original PR description
Steps: - Create a program type = Coupon - Set rules & rewards, In rewards give free product - Generate a new coupon & copy it - Open POS and open Enter code - Paste the newly created coupon without adding any product in pos cart Issue: - Traceback error when manually applying a coupon in the POS with an empty cart. Cause: - Attempts to access coupon.balance to display a message, but the loyalty.card model does not have a field named balance. Fix: - Replace coupon.balance with coupon.points. task-4070130
Miscellaneous changes
### Steps to reproduce: - Install Purchase and Accounting - Go in Accounting > Configuration > Accounting > Taxes - Select the line with "Tax Type" equal to "Purchases" - In advanced options tick "Included in Price" - In the Purchase app create a new RFQ and add the tax - Confirm the order and receive the products - In the Purchase Order form view go in Action > Accrued Expense Entry - Change the date to a month from now, lines should appear - These lines have the price including the ta
Original PR description
### Steps to reproduce: - Install Purchase and Accounting - Go in Accounting > Configuration > Accounting > Taxes - Select the line with "Tax Type" equal to "Purchases" - In advanced options tick "Included in Price" - In the Purchase app create a new RFQ and add the tax - Confirm the order and receive the products - In the Purchase Order form view go in Action > Accrued Expense Entry - Change the date to a month from now, lines should appear - These lines have the price including the taxes, it should be without ### Cause: The calculation of the problematic price is `qty_to_invoice * price_unit`, which is problematic with included taxes. ### Solution: Instead of calculating the price we use the `price_subtotal` calculated by the `compute_all` method. We can not use `price_subtotal` of the line as it includes the whole quantity and not only the quantity to invoice. opw-4045737 Forward-Port-Of: odoo/odoo#175931 Forward-Port-Of: odoo/odoo#173662
A display issue in the mail input field on public pages has been corrected by removing a styling dependency that was not available there. This helps ensure the input appears consistently for visitors using public-facing pages.
Original PR description
The SCSS class `.o_input` is not available in public asset bundles and half of the attributes were bypassed anyway. This commit get rids of this unnecessary dependency. Before / After <img width="317" alt="Screenshot 2024-08-07 at 11 36 24" src="https://github.com/user-attachments/assets/2751a933-c757-4700-b9f3-8299ffe59002"> <img width="288" alt="Screenshot 2024-08-07 at 11 36 10" src="https://github.com/user-attachments/assets/58f20a9d-c530-46a2-b1d0-2ac529f84eb4"> TASK-4100234
Employees can now manually check in or out through Attendance Kiosk Mode even when their profile has no photo. This prevents an error that blocked attendance actions for employees missing an avatar.
Original PR description
Currently, an error occurs when employees manually do their attendance, and an employee's avatar is not available. Step to produce: - Install the 'hr_attendance' module. - Go to the Employees open…
Currently, an error occurs when employees manually do their attendance, and an employee's avatar is not available.
Step to produce:
- Install the 'hr_attendance' module.
- Go to the Employees open any employee and remove an image from it.
- Go to Attendances / Kiosk Mode and click 'Identify Manually', Open the employee who does not have an image.
Stack Trace:
```
TypeError: 'bool' object is not subscriptable
File "odoo/http.py", line 2373, in __call__
response = request._serve_db()
File "odoo/http.py", line 1903, in _serve_db
return self._transactioning(
File "odoo/http.py", line 1966, in _transactioning
return service_model.retrying(func, env=self.env)
File "odoo/service/model.py", line 134, in retrying
result = func()
File "odoo/http.py", line 1933, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2177, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 223, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 754, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/hr_attendance/controllers/main.py", line 137, in employee_attendance_data
return self._get_employee_info_response(employee)
File "addons/hr_attendance/controllers/main.py", line 39, in _get_employee_info_response
'employee_avatar': image_data_uri(employee.image_256),
File "odoo/tools/image.py", line 540, in image_data_uri
FILETYPE_BASE64_MAGICWORD.get(base64_source[:1], 'png'),
```
An error occurs when the system tries to retrieve a data URL from an employee image but it is not available resulting False (bool) value passing instead of binary.
link [1]:https://github.com/odoo/odoo/blob/0a69d91ff2ccb90fc5ca94013a4fc7371017c876/addons/hr_attendance/controllers/main.py#L39
To handle this issue, Add a condition that, Only converts data URI from an employee's image if it is available.
Sentry-5681797884
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-prWhen a vendor bill is posted without a payment reference, Odoo now automatically uses the bill reference instead. This prevents empty payment labels and improves consistency in accounting entries generated from bills.
Original PR description
[FIX] account: Fix the payment reference if empty We have a placeholder on the payment reference "Use Bill Reference" which should use the bill ref if the payment reference if empty We added the placeholder and forgot to add the logic of it Solution: when posting, fill the payment ref with the bill ref if empty Benefit: This will help odoo when recomputing the label of the journal items when posting the bills as it's currently having it empty as we missed to have that functionality in-place when we added the placeholder task-id#4004739 enterprise-pr#[66300](https://github.com/odoo/enterprise/pull/66300) --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Users can now remove the journal while registering an invoice payment without causing an error screen. This keeps the payment workflow stable and avoids interruptions from an invalid or missing journal selection.
Original PR description
Currently, a traceback occurs when the user removes the `journal` while registering a payment. To reproduce this issue: 1) Install `accounting` 2) create an invoice with a line and confirm it 3) Click on `payment Register` and remove the `journal` Error:- ``` ValueError: Expected singleton: account.journal() ``` This is because when the user removes the journal a compute method triggers, through which another method `_fetch_duplicate_reference` calls. In this method, `journal_id` is referenced to call another method in which ensure one is used. This leads to the traceback https://github.com/odoo/odoo/blob/79aef2ed06f813197651f83272d4508200a8ce72/addons/account/wizard/account_payment_register.py#L675-L677 After applying this commit, it will resolve this issue by doing an extra check of j`ournal_id`, which makes the code more robust. sentry-5675331371
Vendor bills now automatically use the bill reference as the payment reference when no payment reference is entered. This prevents blank payment labels during posting and helps accounting entries stay clear and consistent.
Original PR description
[FIX] account: Fix the payment reference if empty We have a placeholder on the payment reference "Use Bill Reference" which should use the bill ref if the payment reference if empty We added the placeholder and forgot to add the logic of it Solution: when posting, fill the payment ref with the bill ref if empty Benefit: This will help odoo when recomputing the label of the journal items when posting the bills as it's currently having it empty as we missed to have that functionality in-place when we added the placeholder task-id#4004739 odoo-pr#[172387](https://github.com/odoo/odoo/pull/172387)
**Steps to reproduce the bug:** - Create a storable product "A1" and "A2". - Update their available quantity to 5. - Create a picking with 5 units of "A1" and another picking with 5 units of "A2". - Confirm both pickings. - Create a new wave transfer and add both pickings. - Update the quantity of "A1" to 0 units. - Try to validate the wave. **Problem:** A user error is triggered: "You cannot validate a transfer if no quantities are reserved. To force the transfer, encode quantities."
Original PR description
**Steps to reproduce the bug:** - Create a storable product "A1" and "A2". - Update their available quantity to 5. - Create a picking with 5 units of "A1" and another picking with 5 units of "A2". - Confirm both pickings. - Create a new wave transfer and add both pickings. - Update the quantity of "A1" to 0 units. - Try to validate the wave. **Problem:** A user error is triggered: "You cannot validate a transfer if no quantities are reserved. To force the transfer, encode quantities." **Solution:** When the quantity of "A1" is updated to 0, the state of the picking becomes "confirmed" instead of "assigned" and as all the moves in this picking have a 0 quantity, we can exclude it from the wave and allow the wave validation. opw-4016209 Forward-Port-Of: odoo/odoo#175888
When importing an invoice in account_edi_ubl_cii there is a function `_correct_invoice_tax_amount` that if there is a rounding error on the tax line then it would correct it. That method was using tax_line_id but as the context manager was placed in a scope above, dynamic lines wouldn't be still generated and so wouldn't work. The fix was to remove the context manager from above and replace it in the actual scope. This had to ensure that all other import methods such as it_edi, es_edi, ... wo
Original PR description
When importing an invoice in account_edi_ubl_cii there is a function `_correct_invoice_tax_amount` that if there is a rounding error on the tax line then it would correct it. That method was using tax_line_id but as the context manager was placed in a scope above, dynamic lines wouldn't be still generated and so wouldn't work. The fix was to remove the context manager from above and replace it in the actual scope. This had to ensure that all other import methods such as it_edi, es_edi, ... would have the context manager in their import functions. opw-4019601 related: https://github.com/odoo/enterprise/pull/67002 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175187 Forward-Port-Of: odoo/odoo#173843
**Before commit** - When the electronic scale is disconnected, its connection status is not updated. **After commit** - When the electronic scale is disconnected, the status of the electronic scale will be updated. **Error Description** - If you have a digital scale that is connected and selected for use in POS. - The status of IoT devices is updated via the router `/hw_proxy/status_json` and the function `get_status()` - However, the status of the digital scale is not updat
Original PR description
**Before commit** - When the electronic scale is disconnected, its connection status is not updated. **After commit** - When the electronic scale is disconnected, the status of the electronic scale…
**Before commit** - When the electronic scale is disconnected, its connection status is not updated. **After commit** - When the electronic scale is disconnected, the status of the electronic scale will be updated. **Error Description** - If you have a digital scale that is connected and selected for use in POS. - The status of IoT devices is updated via the router `/hw_proxy/status_json` and the function `get_status()` - However, the status of the digital scale is not updated when it is disconnected. This leads to the scale still reporting that it is connected when calling the `get_status()` function. The scale status is updated via `self._status` https://github.com/odoo/odoo/blob/8ff2381901e4920434eaee73f8c265fc67271c99/addons/hw_drivers/iot_handlers/drivers/SerialScaleDriver.py#L110-L114 However `self._status` is not updated when disconnected. https://github.com/odoo/odoo/blob/8ff2381901e4920434eaee73f8c265fc67271c99/addons/hw_drivers/iot_handlers/drivers/SerialBaseDriver.py#L129-L144 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175063
This commit adapts the `analytic_distribution` field with `filtered_domain` method. Since the `analytic_distribution` field is a JSON field, it is not natively supported by the methods (search, filtered_domain, etc.). The `analytic.mixin` mixin already handles `search` and `read_group` by applying its own logic in overrides of these. This fix is therefore similar and overrides `filtered_domain` and `mapped` (which is used by the latter). An example of a flow where this case is problemat
Original PR description
This commit adapts the `analytic_distribution` field with `filtered_domain` method. Since the `analytic_distribution` field is a JSON field, it is not natively supported by the methods (search,…
This commit adapts the `analytic_distribution` field with `filtered_domain` method.
Since the `analytic_distribution` field is a JSON field, it is not natively supported by the methods (search, filtered_domain, etc.). The `analytic.mixin` mixin already handles `search` and `read_group` by applying its own logic in overrides of these.
This fix is therefore similar and overrides `filtered_domain` and `mapped` (which is used by the latter).
An example of a flow where this case is problematic is when adding an approval rule via studio (a feature enabling, for example, some methods/buttons to be clickable only if the user is authorized).
To do this, the user must enter a domain, thus filtering the records on which he wishes to apply the approval rule.
In our case, using “analytic_distribution” in a domain doesn't work, because studio uses a `filtered_domain` to find out whether the current record corresponds to the condition set by the domain.
But once in `filtered_domain` we arrive here
https://github.com/odoo/odoo/blob/b527b8643400f4bca74aeb397cde9e5d260f01ff/odoo/models.py#L6203-L6204
`record.mapped(key)` where key is `analytic_distribution` returns the entire JSON object, in the form of an object array containing as key a comma-separated list of ids whose value is a float, for example: `{“16,17”: 100.0}`.
Since our domain in this case looks something like `[“analytic_distribution”, “=”, “Administrative”]`
we compare `Administrative` with `{“16,17”: 100.0}` and `filtered_domain` returns False and our record is never detected.
So this fix is in two parts,
first, we make sure that mapped doesn't return the whole `analytic_distribution` object, but just the values we're interested in: the ids. To do this, we use the method already available in `analytic.mixin`: `_get_analytic_account_ids`.
So instead of comparing `Administrative` with `{“16,17”: 100.0}`, we'll compare the id directly, so something like comparing `Administrative` with `[16,17]`.
Now that we have a clean list of ids, we can replace the display name `Administrative` with its id to compare ids with ids.
To do this, we'll override `filtered_domain` so that if we call it with the following domain `[“analytic_distribution”, “=”, “Administrative”]`, we'll rewrite the domain to facilitate the final call of the real `filtered_domain` method. The result is: `[“analytic_distribution”, “=”, [17]]`.
Proceed in the same way as in `_search_analytic_distribution` to retrieve the id using a `name_search`.
https://github.com/odoo/odoo/blob/d6bdb05771fd29a79f2e8087b92a438fec28afaa/addons/analytic/models/analytic_mixin.py#L51-L58
opw-4002202
Forward-Port-Of: odoo/odoo#175018Steps ----- 1. Have a product of type "Service" with "Subcontract Service" activated on the Purchase page and with at least a vendor. 2. Create a Sales Order with this product. When confirming it, a PO will be automatically created. 3. Create another Sales Order with the product. 4. The PO now has 2 lines, but the "Source Document" in "Other Information" of the PO only contains the name of the first SO. Cause ----- Refactor e54b57ee74893170134438a9b5873db4dfd03ddc changed the logic. If
Original PR description
Steps ----- 1. Have a product of type "Service" with "Subcontract Service" activated on the Purchase page and with at least a vendor. 2. Create a Sales Order with this product. When confirming it, a PO will be automatically created. 3. Create another Sales Order with the product. 4. The PO now has 2 lines, but the "Source Document" in "Other Information" of the PO only contains the name of the first SO. Cause ----- Refactor e54b57ee74893170134438a9b5873db4dfd03ddc changed the logic. If a PO is found by _purchase_service_match_purchase_order, it should have its origin modified to include the new SO (not the case currently). opw-4049834 Forward-Port-Of: odoo/odoo#174051
We previously took into account all possible Message-IDs found in the References header of incoming messages. We also don't try to match the `In-Reply-To` header separately, since it is supposed to be appended to the `References` header, when present. This is all specified in RFC5322, section 3.6.4: https://datatracker.ietf.org/doc/html/rfc5322#section-3.6.4 However, for very long threads, the `References` field can contain dozens or even hundreds of previous Message-IDs, even though w
Original PR description
We previously took into account all possible Message-IDs found in the References header of incoming messages. We also don't try to match the `In-Reply-To` header separately, since it is supposed to…
We previously took into account all possible Message-IDs found in the References header of incoming messages. We also don't try to match the `In-Reply-To` header separately, since it is supposed to be appended to the `References` header, when present. This is all specified in RFC5322, section 3.6.4: https://datatracker.ietf.org/doc/html/rfc5322#section-3.6.4 However, for very long threads, the `References` field can contain dozens or even hundreds of previous Message-IDs, even though we generally care only about the last one. This can be an issue for databases with a large number of messages, as the query planner could mistakenly choose a suboptimal plan (e.g. a Seq Scan or filtered Index Scan), rather than looping on the `message_id` index, which is the best plan. Here we truncate the list of References to only include the last 32 ones. For most threads this will make no difference, as they have less than 32 referencs. For very long threads it should still pick up the last known Message-ID without trouble. And if the last 32 messages aren't known by the system, it's unlikely that the message should still be considered part of earlier threads - it's been sidetracked elsewhere. PS: also simplify the `order` clause, as no secondary sort criterion is going to work after `ORDER BY id`. Forward-Port-Of: odoo/odoo#175681
If you print changes in a restaurant, then print the receipt of the same order. The receipt would contain the changes. Steps to reproduce: ------------------- * Setup a printer to print changes and give it the IP 0.0.0.0 so that it fails * Open a PoS restaurant * Add some product to the order, and send it in preparation * You will have an error * Pay for the order, and print the receipt with web print > Observation: The changes of the order appears on top of the receipt Why the fix:
Original PR description
If you print changes in a restaurant, then print the receipt of the same order. The receipt would contain the changes. Steps to reproduce: ------------------- * Setup a printer to print changes and give it the IP 0.0.0.0 so that it fails * Open a PoS restaurant * Add some product to the order, and send it in preparation * You will have an error * Pay for the order, and print the receipt with web print > Observation: The changes of the order appears on top of the receipt Why the fix: ------------ This was happening because the content of `render-container` was not emptied. So when trying to print the receipt, the content of the receipt was added to the changes already in the `render-container` opw-4027722 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#174948
Previously, there was no clean way to redirect old URLs like /xx.asp?id=xx with the correct HTTP status code. This update adds support for such redirects, allowing people to migrate to Odoo more easily. fiximp-realife --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175188
Original PR description
Previously, there was no clean way to redirect old URLs like /xx.asp?id=xx with the correct HTTP status code. This update adds support for such redirects, allowing people to migrate to Odoo more easily. fiximp-realife --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175188
### Steps to reproduce: - Create a product tracked by lot with a BOM - Create and confirm an MO for 1 unit of that product - Assign a producing lot via the [+] smart button - Change the quantity producing to 2 and produce all > Go on the Traceability Report an additional move_line associated to your MO finished move was created and associated to the producing lot. - Unlock the MO and change the quantity producing to 3 > Go on the Traceability Report an additional move_line associated t
Original PR description
### Steps to reproduce: - Create a product tracked by lot with a BOM - Create and confirm an MO for 1 unit of that product - Assign a producing lot via the [+] smart button - Change the quantity…
### Steps to reproduce: - Create a product tracked by lot with a BOM - Create and confirm an MO for 1 unit of that product - Assign a producing lot via the [+] smart button - Change the quantity producing to 2 and produce all > Go on the Traceability Report an additional move_line associated to your MO finished move was created and associated to the producing lot. - Unlock the MO and change the quantity producing to 3 > Go on the Traceability Report an additional move_line associated to your MO finished move was created and associated but the producing lot **is missing** ### Cause of the issue: Changing the quantity producing on the MO and then marking the MO as done will trigger a call of the `_post_inventory` method. During this call the quantity of the finished move are adapted according to the quantity producing of the MO by these lines: https://github.com/odoo/odoo/blob/4a388236ce49e03e3a32447f8fa6ed073a09126b/addons/mrp/models/mrp_production.py#L1700-L1702 The change of quantity will trigger a `_process_increase` of the qties of the finished move and will create an additional stock move line for the remaining qties: https://github.com/odoo/odoo/blob/4a388236ce49e03e3a32447f8fa6ed073a09126b/addons/stock/models/stock_move.py#L2051-L2055 and the producing lot is added to this new line just after because of these lines: https://github.com/odoo/odoo/blob/4a388236ce49e03e3a32447f8fa6ed073a09126b/addons/mrp/models/mrp_production.py#L1702-L1705 https://github.com/odoo/odoo/blob/f80094f43bcc464cc99fba6aa59f64659fe659b6/addons/mrp/models/mrp_production.py#L2780-L2784 By contrast, if you modify the quantity producing after the MO is marked as done, the quantity of the finished_move is modified dirrectly by the ovewrite of the `write` method of the `mrp_production` model: https://github.com/odoo/odoo/blob/4a388236ce49e03e3a32447f8fa6ed073a09126b/addons/mrp/models/mrp_production.py#L898-L899 This will also trigger a `_process_increase` but it will not add the `lot_id` to the new sml as in the `_post_inventory` call. opw-4043539 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175220 Forward-Port-Of: odoo/odoo#174489
This commit optimizes the `_accumulate_amounts` method. Previously, when there were many stock moves per PoS order, the '_compute_average_price' would be called for each move, resulting in multiple identical queries for each valuation layer in each stock move. Now, the stock moves and valuation layers for an order are prefetched at once, significantly reducing the number of database queries. This results in a performance improvement, especially when processing a large number of PoS orders and
Original PR description
This commit optimizes the `_accumulate_amounts` method. Previously, when there were many stock moves per PoS order, the '_compute_average_price' would be called for each move, resulting in multiple identical queries for each valuation layer in each stock move. Now, the stock moves and valuation layers for an order are prefetched at once, significantly reducing the number of database queries. This results in a performance improvement, especially when processing a large number of PoS orders and stock moves. | Scenario | Before Optimization (seconds) | After Optimization (seconds) | |----------|------------------------------|-----------------------------| | 100 orders, 1,000 stock moves | 20 | 5 | | 300 orders, 100,000 stock moves | 617 | 23 | opw-3980597 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#171955 Forward-Port-Of: odoo/odoo#168963
… when the package type is scanned using the barcode Description of the issue this PR addresses: This PR aims to resolve the issue where the IoT scale is connected but unable to retrieve the weight from the scale. Steps to reproduce: 1. Enable packaging configuration. 2. Create a sales order and confirm it; this will generate a delivery. 3. Find that delivery in the ‘Barcode’ app. 4. Add/scan the product. 5. Scan the package type. Current behavior before PR: Following the above
Original PR description
… when the package type is scanned using the barcode Description of the issue this PR addresses: This PR aims to resolve the issue where the IoT scale is connected but unable to retrieve the weight…
… when the package type is scanned using the barcode Description of the issue this PR addresses: This PR aims to resolve the issue where the IoT scale is connected but unable to retrieve the weight from the scale. Steps to reproduce: 1. Enable packaging configuration. 2. Create a sales order and confirm it; this will generate a delivery. 3. Find that delivery in the ‘Barcode’ app. 4. Add/scan the product. 5. Scan the package type. Current behavior before PR: Following the above steps, when the package type is scanned using the barcode, the scanned package type is not populated in the opened package wizard. Consequently, the shipping weight field is not visible, preventing the retrieval of the weight from the IoT scale. Please refer to the screen recording before the PR: https://github.com/user-attachments/assets/e4764005-6758-4f80-a189-e27e8897f853 Desired behavior after PR is merged: After merging this PR, when the package type is scanned using the barcode, the scanned package type will be correctly populated in the opened wizard. As a result, the shipping weight will be visible, and it will be able to retrieve the scale weight from IoT. Please refer to the screen recording after the PR: https://github.com/user-attachments/assets/f408ee60-2495-48a5-96ea-3ced502c85dc --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#173949
`install` alias could not mount `/proc` as it was performed using 'sudo', which is unavailable as root is `/root_bypass_ramdisks` at this time. Forward-Port-Of: odoo/odoo#175297
Original PR description
`install` alias could not mount `/proc` as it was performed using 'sudo', which is unavailable as root is `/root_bypass_ramdisks` at this time. Forward-Port-Of: odoo/odoo#175297
Issue: The `_get_weight` method is called for each location to compute the weight and it sums up all the incoming and outgoing lines for forecasted weight. Using filtered for each record is compute intensive and gets slower over time. While returning a delivery with 30 stock moves the _create_return took 7:41 minutes most of which were on `_get_weight`. Here filtered alone was taking over 6 minutes. 
Original PR description
Issue: The `_get_weight` method is called for each location to compute the weight and it sums up all the incoming and outgoing lines for forecasted weight. Using filtered for each record is compute…
Issue: The `_get_weight` method is called for each location to compute the weight and it sums up all the incoming and outgoing lines for forecasted weight. Using filtered for each record is compute intensive and gets slower over time. While returning a delivery with 30 stock moves the _create_return took 7:41 minutes most of which were on `_get_weight`. Here filtered alone was taking over 6 minutes.  For a single run, || Before| | --------- | ------------- | |Quants| 5474 | |Outgoing Move Lines| 38020 | |Incoming Move Lines| 150935 | |Time| 246.05s | Solution: Optimized the `_get_weight` method to use `read_group` to get the sum of incoming and outgoing lines. This reduces the number of reads. Total time for the same return reduced to 28s.  For a single run: || After| | --------- | ------------- | |Quants| 5474 | |Outgoing Move Lines| 38020 | |Incoming Move Lines| 150935 | |Time| 0.4s | --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175180 Forward-Port-Of: odoo/odoo#170675
**Current behavior:** When editing an email template with a link, it will get removed when switching in/out of the codeview editor even if it has some useful value. **Expected behavior:** These links will not be removed. **Steps to reproduce:** *Install sale_stock* 1. Go to email templates, select `Shipping: Send by Email` 2. Select the body content, activate the codeview editor mode 3. Some content has been removed, while codeview editor is open, reset the template and o
Original PR description
**Current behavior:**
When editing an email template with a link, it will get removed
when switching in/out of the codeview editor even if it has some
useful value.
**Expected behavior:**
These links will not be removed.
**Steps to reproduce:**
*Install sale_stock*
1. Go to email templates, select `Shipping: Send by Email`
2. Select the body content, activate the codeview editor mode
3. Some content has been removed, while codeview editor is open,
reset the template and observe the change
4. This results in a delivery order email not having the
tracking link in its body
**Cause of the issue:**
On codeview save, we remove empty links- however some links may
have a t-out value and are still lost.
**Fix:**
Check for a t-attribute in the link node's attributes before
removing it.
opw-3919379
Forward-Port-Of: odoo/odoo#167150Due to Stripe sending multiple confirmations regarding authorized payment, multiple mails were send to customer that their payment was succesful, now only transactions that were not processed yet result in mail sending. opw-3967807 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#168298
Original PR description
Due to Stripe sending multiple confirmations regarding authorized payment, multiple mails were send to customer that their payment was succesful, now only transactions that were not processed yet result in mail sending. opw-3967807 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#168298
Before this commit, if an order failed to synchronize due to a concurrent update error, the order would be captured in one process and saved as an attachment in another process. This fix ensures that the attachment is removed when capturing an order that already exists in the database, thereby eliminating unnecessary POS order attachments. opw-4091844 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175668 Forward-Port-Of
Original PR description
Before this commit, if an order failed to synchronize due to a concurrent update error, the order would be captured in one process and saved as an attachment in another process. This fix ensures that the attachment is removed when capturing an order that already exists in the database, thereby eliminating unnecessary POS order attachments. opw-4091844 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#175668 Forward-Port-Of: odoo/odoo#175551
Before this PR: - the HSN code on products determined HSN code warnings. After this PR: - This update modifies the computation of HSN warnings based on journal items rather than products. This change enhances the accuracy of HSN code validation by focusing on the financial entries. Task ID: 4085936 Forward-Port-Of: odoo/enterprise#67685
Original PR description
Before this PR: - the HSN code on products determined HSN code warnings. After this PR: - This update modifies the computation of HSN warnings based on journal items rather than products. This change enhances the accuracy of HSN code validation by focusing on the financial entries. Task ID: 4085936 Forward-Port-Of: odoo/enterprise#67685
This commit aims to move the context manager '_get_edi_creation()' from account.move to the import methods inside edi's such as mx_edi, ke_edi because moving it to account_move method: '_extend_with_attachments' was causing issue to the importation of bills from account_edi_ubl_cii. related: https://github.com/odoo/odoo/pull/173843 Forward-Port-Of: odoo/enterprise#67725 Forward-Port-Of: odoo/enterprise#67002
Original PR description
This commit aims to move the context manager '_get_edi_creation()' from account.move to the import methods inside edi's such as mx_edi, ke_edi because moving it to account_move method: '_extend_with_attachments' was causing issue to the importation of bills from account_edi_ubl_cii. related: https://github.com/odoo/odoo/pull/173843 Forward-Port-Of: odoo/enterprise#67725 Forward-Port-Of: odoo/enterprise#67002
Problem: An issue arises due to a negative analytical distribution. If the analytical percentage is negative, its sign will match the sign of the amount_currency of its move line. However, in the query that groups by the analytical account for P&L, the amount value is inverted. This does not cause a problem when the analytic percentage is positive because the amount_currency sign is opposite to the sign of the analytic line amount. But, in cases where the sign is the same, there will be a balan
Original PR description
Problem: An issue arises due to a negative analytical distribution. If the analytical percentage is negative, its sign will match the sign of the amount_currency of its move line. However, in the…
Problem: An issue arises due to a negative analytical distribution. If the analytical percentage is negative, its sign will match the sign of the amount_currency of its move line. However, in the query that groups by the analytical account for P&L, the amount value is inverted. This does not cause a problem when the analytic percentage is positive because the amount_currency sign is opposite to the sign of the analytic line amount. But, in cases where the sign is the same, there will be a balance with a different sign than the amount, which will not comply with the constraint of the account.move.line table: "account_move_line_check_amount_currency_balance_sign". Steps to reproduce: 1. Activate "Analytic Accounting" in the settings 2. In an invoice, set an analytic distribution with a negative percentage 3. Validate the invoice 4. Go to P&L report an try to group by an analytic account 5. A validation error will occur. Proposed solution: Remove the constraint in the temporary table. opw-4092475 opw-4092232 opw-4086515 opw-4084850 opw-4083077 Forward-Port-Of: odoo/enterprise#68057 Forward-Port-Of: odoo/enterprise#67953
Create Branch Set up Avatax on main company Try to compute taxes using Avatax on Branch company Issue: Receive error asking to add Avatax Credentials When working with branches, Avatax should only be configured on the main company and not from the branches, since the tax report will be done from the parent. opw-3962212 Forward-Port-Of: odoo/enterprise#66681
Original PR description
Create Branch Set up Avatax on main company Try to compute taxes using Avatax on Branch company Issue: Receive error asking to add Avatax Credentials When working with branches, Avatax should only be configured on the main company and not from the branches, since the tax report will be done from the parent. opw-3962212 Forward-Port-Of: odoo/enterprise#66681
Currently, a traceback may occur when we get the token as false Error:- ``` TypeError: can only concatenate str (not "bool") to str File "odoo/tools/safe_eval.py", line 390, in safe_eval return unsafe_eval(c, globals_dict, locals_dict) File "ir.actions.server(348,)", line 1, in <module> File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi_stock/models/account_move.py", line 14, in cron_run_sii_workflow super(AccountMove, self).cron_run_sii_workflow() File "home/odoo/sr
Original PR description
Currently, a traceback may occur when we get the token as false Error:- ``` TypeError: can only concatenate str (not "bool") to str File "odoo/tools/safe_eval.py", line 390, in safe_eval return…
Currently, a traceback may occur when we get the token as false
Error:-
```
TypeError: can only concatenate str (not "bool") to str
File "odoo/tools/safe_eval.py", line 390, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "ir.actions.server(348,)", line 1, in <module>
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi_stock/models/account_move.py", line 14, in cron_run_sii_workflow
super(AccountMove, self).cron_run_sii_workflow()
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/account_move.py", line 806, in cron_run_sii_workflow
self_skip._l10n_cl_ask_claim_status()
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/account_move.py", line 780, in _l10n_cl_ask_claim_status
move.l10n_cl_verify_claim_status()
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/account_move.py", line 288, in l10n_cl_verify_claim_status
response = self._get_dte_claim(
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/l10n_cl_edi_util.py", line 408, in _get_dte_claim
settings = Settings(strict=False, extra_http_headers={'Cookie': 'TOKEN=' + token})
ValueError: <class 'TypeError'>: "can only concatenate str (not "bool") to str" while evaluating
'model.cron_run_sii_workflow()'
File "odoo/addons/base/models/ir_cron.py", line 388, in _callback
self.env['ir.actions.server'].browse(server_action_id).run()
File "home/odoo/src/custom/trial/saas_trial/models/sentry.py", line 33, in run
res = super().run()
File "odoo/addons/base/models/ir_actions.py", line 971, in run
res = runner(run_self, eval_context=eval_context)
File "addons/website/models/ir_actions_server.py", line 61, in _run_action_code_multi
res = super(ServerAction, self)._run_action_code_multi(eval_context)
File "odoo/addons/base/models/ir_actions.py", line 801, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self)) # nocopy allows to return 'action'
File "odoo/tools/safe_eval.py", line 404, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
```
But here in the code, only the None case was handled. https://github.com/odoo/enterprise/blob/5dae45bea35b55e88e1d7199a555f9cc5375c899/l10n_cl_edi/models/l10n_cl_edi_util.py#L407-L410
After applying this commit it will resolve this issue by handling all the falsy cases for the token.
sentry-5539925394
Forward-Port-Of: odoo/enterprise#66232Steps: - Install `web_studio` - Open Studio report view from any model (e.g: Users) - Double click on any report kanban card - Crash because component is destroyed In this case: - First click create the first `ReportEditorModel` https://github.com/odoo/enterprise/blob/cebfacec4e5c6f24ed7f915da204867e39ba53ca/web_studio/static/src/client_action/report_editor/report_editor_model.js#L401 - This first instance of `ReportEditorModel` make two calls via `this.loadReportDa
Original PR description
Steps: - Install `web_studio` - Open Studio report view from any model (e.g: Users) - Double click on any report kanban card - Crash because component is destroyed In this case: - First click create…
Steps:
- Install `web_studio`
- Open Studio report view from any model (e.g: Users)
- Double click on any report kanban card
- Crash because component is destroyed
In this case:
- First click create the first `ReportEditorModel`
https://github.com/odoo/enterprise/blob/cebfacec4e5c6f24ed7f915da204867e39ba53ca/web_studio/static/src/client_action/report_editor/report_editor_model.js#L401
- This first instance of `ReportEditorModel` make two calls via `this.loadReportData` (rpc) and `this.loadModelEnv` (orm.search)
- Second click create a second instance of `ReportEditorModel` which destroys the first instance to replace it.
- The problem is that the RPC of the first instance has not yet had time to execute, so by the time it arrives the component is already destroyed, which causes the problem
This commit fixes the problem by checking the state of reportEditorModel, if it is destroyed we don't call the loaders
opw-3973038
Forward-Port-Of: odoo/enterprise#64876Forward-Port-Of: odoo/enterprise#67805
Original PR description
Forward-Port-Of: odoo/enterprise#67805
Fixed `test_industry_fsm_at_install` by activating the pricelist before creating the sale order to ensure a proper link. task-4070526 Forward-Port-Of: odoo/enterprise#67823 Forward-Port-Of: odoo/enterprise#67612
Original PR description
Fixed `test_industry_fsm_at_install` by activating the pricelist before creating the sale order to ensure a proper link. task-4070526 Forward-Port-Of: odoo/enterprise#67823 Forward-Port-Of: odoo/enterprise#67612
Version: saas-17.2 Before this commit: the warning notification for the auto plan would stay on the screen even when navigating to another page. cause: the warning notification were set to be sticky but did not properly handle removing the notification when navigate to another page. Solution: added a method to remove notifications after navigating to another page. task-4023197 Forward-Port-Of: odoo/enterprise#66037
Original PR description
Version: saas-17.2 Before this commit: the warning notification for the auto plan would stay on the screen even when navigating to another page. cause: the warning notification were set to be sticky but did not properly handle removing the notification when navigate to another page. Solution: added a method to remove notifications after navigating to another page. task-4023197 Forward-Port-Of: odoo/enterprise#66037
Version: saas-17.1 Before this commit: the notification for the auto plan would stay on the screen even when navigating to another page. cause: the notification were set to be sticky but did not properly handle removing the notification when navigate to another page. Solution: added a method to remove notifications after navigating to another page. task-4023197 Forward-Port-Of: odoo/enterprise#67628 Forward-Port-Of: odoo/enterprise#66038
Original PR description
Version: saas-17.1 Before this commit: the notification for the auto plan would stay on the screen even when navigating to another page. cause: the notification were set to be sticky but did not properly handle removing the notification when navigate to another page. Solution: added a method to remove notifications after navigating to another page. task-4023197 Forward-Port-Of: odoo/enterprise#67628 Forward-Port-Of: odoo/enterprise#66038