Daily updates from Odoo
Tuesday, June 2, 2026
23 changes · saas-19.3
Resolved issues and error corrections
This update addresses a requirement from the Peruvian tax authority (SUNAT) regarding delivery guides. Customers using the older version of our l10n_pe_edi_stock module were receiving errors due to a missing field. We’ve updated the module to include this required date, ensuring compliance and preventing delivery guide rejections. Customers using older versions need to update to this latest module to avoid issues.
Original PR description
SUNAT R. S. N° 000108-2026/SUNAT and the GRE validation rules published on 2026-06-01 add field 34 "Fecha de entrega de bienes al transportista" (cac:LoadingTransportEvent/cbc:OccurrenceDate). It is required, and rejected with error 3617 when absent, only when the transport modality is '01' (public transport). Enforcement started 2026-06-01, so affected customers can no longer submit their delivery guides.
In our implementation the departure start date is equivalent to this date, so we reuse it instead of adding a new field. The node is gated to public transport to match the validation rule and avoid emitting it on private transport ('02') guides.
Because the new node only ships with this module version, customers on an older version keep hitting error 3617 from SUNAT. Detect that code in the SUNAT response and store an actionable message asking the user to update the module, instead of surfacing the raw rejection.
task-6266662
Forward-Port-Of: odoo/enterprise#119038This update resolves issues related to Philippine taxes and accounting within Odoo. Specifically, it corrects the account type for inventory variations and restructures VAT tax calculations for accurate reporting, aligning with Philippine tax regulations. This ensures correct tax calculations and reporting for Philippine businesses using Odoo.
Original PR description
Update the COA by setting account 502040 (Inventory/Stock Variation) to type `expense`. We also restructure the FWVAT DS/EM tax to use group of taxes design. task-6146238
This update resolves an issue where branch users were unable to create new journal entries due to an access restriction within the accounting module. The fix adds elevated permissions to the query used to identify sequence gaps, allowing branch users to correctly create entries without encountering an error. This ensures branch users can perform standard accounting tasks.
Original PR description
**Steps to reproduce:** * Create a parent company with a branch company (Settings > Companies). * Create a user whose **only** allowed company is the branch. * While logged in as a parent-company…
**Steps to reproduce:** * Create a parent company with a branch company (Settings > Companies). * Create a user whose **only** allowed company is the branch. * While logged in as a parent-company admin, open the Miscellaneous Operations journal, find the first or second posted entry, reset it to draft, clear its name to a digits-only value (e.g. `0001`) and save – leaving it in draft state. This stores `sequence_prefix = ''` and `sequence_number = 1` in the database. * Log in as the branch-company user. * Navigate to Accounting > Journal Entries > New. * Set any date and save the draft entry (or simply write `name = '/'` on it). **Observed behavior:** * Saving fails with: `odoo.exceptions.AccessError: You are not allowed to access 'Journal Entry' (account.move) records.` **Cause:** * `_update_sequence_made_gap`, introduced in 19.0, detects sequence holes by running a raw SQL query that finds the two entries immediately before and after each move in the same journal with the same `sequence_prefix`. The query contains **no `company_id` filter**. * In a branch-company setup the parent's journal (`journal_id`) is shared across companies. When an early entry's `name` is cleared to a digits-only value its `sequence_prefix` becomes `''`. A new entry created by the branch user also starts with `name = '/'`, which gives it `sequence_prefix = ''` and `sequence_number = 0`. The SQL therefore returns the parent company's entry (`sequence_number = 1`, `sequence_prefix = ''`) as the `next_id` neighbour. * The IDs from that query are passed to a local `browse()` closure, which in 19.0 read: https://github.com/odoo/odoo/blob/af37df9bee34fe60c1e51896af23fc7fe9b76cfc/addons/account/models/account_move.py#L5770-L5771 * `self.browse()` inherits the **non-sudo** environment of the branch user. When the method subsequently writes `move_n1.made_sequence_gap = …` on the browsed parent-company record, the ORM record-rule check finds the branch user has no access to that company → **`AccessError`**. * This is a regression from 18.4 where the equivalent `_set_next_made_sequence_gap` explicitly used `.sudo()` when searching for neighbour moves: https://github.com/odoo/odoo/blob/22d84ae99bb79e7b1022367e6bc1b61cc8d9e8b1/addons/account/models/account_move.py#L5453-L5457 **Fix:** * Add `.sudo()` inside the `browse()` closure so that neighbouring moves are always accessed with elevated rights, regardless of the calling user's company context. * `made_sequence_gap` is a UI-only flag that indicates sequence holes; it carries no security or financial significance, making the sudo escalation safe. opw-6231085 Forward-Port-Of: odoo/odoo#266676
This update corrects a problem where the E-Invoice QR code would break when multiple invoices were displayed, and a related issue with the Mydata classification group shrinking. The layout has been adjusted to ensure the QR code displays correctly regardless of the number of invoice lines, improving the E-Invoice generation process.
Original PR description
before this commit: - The QR code on the E-Invoice broke when multiple invoice lines were reduced the available space. - Mydata classification group is shrink. after this commit: - Adjusted the layout to ensure the QR code moves to a new page if there isn't enough space on the current page. - Fix Mydata classification shrink issue. task-6026681 Forward-Port-Of: odoo/odoo#266660
This update fixes an issue where subscription products with one-time purchase options were incorrectly displaying recurring subscription prices in the product configurator. Now, the configurator accurately shows the one-time price when this option is selected, ensuring accurate pricing for customers and improving the subscription ordering process across both the website and backend.
Original PR description
Version 19.1 steps to reproduce: - open sales and open a subscription product. enable accept one time and add another subscription product as an optional product. - open the website product page, select the one time price, and click add to cart. issue: when a subscription product that allows one time purchase is added to the cart or to a subscription order, the product configurator wizard was showing the recurring subscription price instead of the one time price. this issue was present both on the website frontend and in the backend subscription module. fix: the product configurator wizard now correctly shows the one time price when the accept one time option is selected, both on the website frontend and in the backend subscription flow. task: 6126684. Forward-Port-Of: odoo/enterprise#114862
This update resolves an issue where product variants weren't being created properly when a product template used a dynamic attribute with a single value. Previously, the order line would fail to add to the order. This change ensures that product variants are correctly generated, improving the reliability of the Point of Sale functionality.
Original PR description
When a product template has a dynamic attribute with only one value, `isConfigurable()` returns `false` (correctly suppressing the configurator popup), but `create_product_variant_from_pos` was never called, leaving the order line without a proper variant and causing error when trying to add it to the order. opw-6213957 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#265589 Forward-Port-Of: odoo/odoo#264134
This update fixes an issue where multiple Mercado Pago terminals were incorrectly linked to a single payment interface, leading to missed webhook responses. The change ensures that each active terminal receives its own webhook notifications, improving the reliability of payment processing. This resolves a potential problem with duplicate payments or incomplete transactions.
Original PR description
Issue Upon initialization of the pos a PaymentInterface is constructed for every pos_payment_method (even archived pos payment methods ?!). [As we allow only one WebSocket subscription per…
Issue Upon initialization of the pos a PaymentInterface is constructed for every pos_payment_method (even archived pos payment methods ?!). [As we allow only one WebSocket subscription per channel](https://github.com/odoo/odoo/blob/4e1c89890c5fd54a79dcf5bf20268e51d8fe6e69/addons/point_of_sale/static/src/app/utils/payment/payment_interface.js#L100) for the PaymentInterface, all webhook responses will be linked to only one PaymentInterface. Meaning that when you have two Mercado Pago pos_payment_method terminals configured, only the first pos_payment_method (id=1) will be subscribed to the WebSocket and all the webhook responses from the second pos_payment_method terminal (id=2) will arrive to the PayementInterface of the first pos_payment_method (id=1). Where payload.payment_method_id (id=2) != this.payment_method_id.id (id=1). Solution - Only iterate and create a PaymentInterface for compatible pos_payment_methods which are active - Check if the webhook response is linked to the PendingPaymentLine opw-6069455 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#262184
This update resolves a bug that occurred when using Point of Sale with multiple companies. The issue stemmed from how user assignments were being calculated, leading to a 'singleton' error. The fix ensures employees are correctly associated with each company's POS configuration, improving the functionality for businesses managing multiple locations.
Original PR description
Step to reproduce: - install point_of_sale with demo - have two company and 1 pos in each company - install pos_hr - install pos_sale Observation: - we get a traceback ``` File…
Step to reproduce:
- install point_of_sale with demo
- have two company and 1 pos in each company
- install pos_hr
- install pos_sale
Observation:
- we get a traceback
```
File "/src/saas-19.2/odoo/orm/fields_misc.py", line 115, in __get__
raise ValueError("Expected singleton: %s" % record) from None
ValueError: Expected singleton: res.company(7, 8)
```
- and pos_sale is not installed
Cause:
- when installing `pos_sale` `_ensure_downpayment_product` is called.
- this sets downpayment product on every `pos.config` record.
- this triggers write call from pos_hr, which tries to identify users for pos
- this uses `with_company(self.company)` <----- actual issue
- here self has two config, each from different company, hence `with_company`
raises singleton error
why not in earlier verison:
- before commit [1] we only set downpayment product on only pos_config_main
- now we set it on every pos.config, so now self contain multiple records
[1] https://github.com/odoo/odoo/commit/a3f9114434c7cab8757b0283698662792e6b7946
Fix:
- compute users by first grouping them over company_id
related pr: https://github.com/odoo/odoo/pull/254026
opw-6217135
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#264962This update fixes an issue where invoices weren't sorted correctly on the customer portal based on their payment status. The change updates the system to prioritize sorting by payment status, ensuring customers see invoices in the correct order based on whether they've been paid or not. This improves the user experience and accuracy of invoice management.
Original PR description
Steps to produce: --- - Install the `Accounting` module. - Create several invoices for a portal user with different payment states (e.g., In Payment, Not Paid, Paid). - Log in as the portal user. -…
Steps to produce: --- - Install the `Accounting` module. - Create several invoices for a portal user with different payment states (e.g., In Payment, Not Paid, Paid). - Log in as the portal user. - Navigate to the invoices list and attempt to sort by **Status**. Issue:- --- - Sorting by **Status** does not reflect the actual invoice payment status, resulting in incorrect ordering. Root cause: --- - At [1], the sorting field for Status is set to state, which corresponds to invoice states (Draft, Posted, Cancelled). However, the portal displays and expects sorting based on payment_state. Fix: --- - Update the sorting configuration to use payment_state instead of state, ensuring that invoices are sorted correctly according to their payment status on the portal. [1]https://github.com/odoo/odoo/blob/5b85287ec4ea9f1b51e0f33402900777dfeeb725/addons/account/controllers/portal.py#L46-L52 opw-6128998 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#262976
This update resolves an issue where the Account PEPPOL response service wasn't correctly activated after registration. The fix ensures that supported services are updated when the `2/connect` route is used, preventing the service from being missing when the module is installed prior to registration. This ensures proper functionality for PEPPOL integration.
Original PR description
To register as receiver we only call the `2/connect` route (and not any of the other `register*` routes). But currently that route does not update the supported services. Thus the response service is missing when the `account_peppol_response` module is installed before registering. We add the supported document identifiers to the `connect` call here. We change the route on IAP to update the services. task-None IAP PR: https://github.com/odoo/iap-apps/pull/1582 Forward-Port-Of: odoo/odoo#263747
This update ensures all Odoo views automatically update when data changes, resolving issues where some views (like the map view) wouldn't refresh. By centralizing subscriptions within the core system, this fix guarantees a consistent and responsive user experience, preventing disruptions to features like coordinate fetching.
Original PR description
This commit centralizes model event subscriptions within the `useModel` hook to ensure all view controllers reactively update by default. Previously, individual controllers were responsible for manually subscribing to the model's "update" events. Views that omitted this wiring (such as the map view) failed to re-render during mid-session `notify()` calls, breaking features like progressive coordinate fetching. Moving the subscription directly into `useModel` guarantees that all consumer views stay in sync automatically. As a result, the now-redundant manual subscription inside `HierarchyController` has been removed. task-6255163
This update resolves an issue that prevented the map's pin list from updating correctly during slow data loading. By creating a fresh copy of the pin data on demand, the map now displays accurate information more reliably, especially with large maps. This enhances the user experience and ensures the map remains responsive.
Original PR description
Fixes a core model issue where `_filterUnlocatedRecords` destructively mutated `data.recordGroups` in place, making it impossible to evaluate subsequent progressive OSM coordinate arrivals. The baseline state is now preserved in `data.allRecordGroups` at load time, and a fresh copy is derived on each call. To support this progressive rendering, `MapPinListPopover` is equipped with a `useBus` subscription. This ensures that while the core controller subtree updates automatically, this isolated popover also stays in sync with the model. task-6255163
This update fixes an issue where UBL files weren't correctly applying tax rates during import. Previously, the system used a simplified cache key that could lead to incorrect tax assignments for similar lines. This change ensures that the imported tax rates from the UBL file are accurately reflected, improving data consistency.
Original PR description
When we import a UBL file, we call the `_import_retrieve_tax` method to fetch taxes to indicate on lines.
During the process, we use cache to avoid performing the search a second time if a new line is the same as a previous one.
https://github.com/odoo/odoo/blob/d0424f2ffcf99ee59befe288150f1643b3fa0112/addons/account/models/account_tax.py#L4459-L4462
The cache_key used is defined as follows: {line's invoice, line's name, line's partner}.
This implies that if two lines from the same invoice share the same name and partner, the same tax will automatically be used even if different taxes were indicated in the file.
This is not desirable as we should match what is indicated in the XML file imported.
opw-6226166
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#266697This update resolves a bug where formatting (bold, italic, underline) applied to inline code selections within the HTML editor wouldn't be consistently removed. The fix ensures that formatting nodes are correctly handled during selection and removal, providing a more reliable editing experience. This improves the usability of the To-Do module and other areas where inline code is used.
Original PR description
Problem: When selecting text containing `o_inline_code` and applying formatting such as bold, italic, or underline, the formatting cannot be removed. Cause: When applying formatting, nodes matching…
Problem: When selecting text containing `o_inline_code` and applying formatting such as bold, italic, or underline, the formatting cannot be removed. Cause: When applying formatting, nodes matching `is_formattable_node_predicates` are ignored. However, when checking whether the selection is already formatted, those nodes are not ignored, so the selection is erroneously considered to be only partially formatted. Solution: Take `is_formattable_node_predicates` into account when checking whether a selection is formatted. Steps to reproduce: - Go to To-Do → Create New. - Type some text and add inline code on the same line. - Select all content using Ctrl + A. - Apply formatting such as bold, italic, or underline using keyboard shortcuts (Ctrl + B / Ctrl + I / Ctrl + U). - Press the same shortcut again to remove the formatting. - Observe that the formatting is not removed. task-6229228 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#267455 Forward-Port-Of: odoo/odoo#265183
This update fixes a crash that occurred when purchase matching tried to convert vendor bills with only a description and UoM, without a linked product. The change ensures purchase matching works correctly with bills identified solely by their description, maintaining consistency in quantity calculations. This improves the reliability of importing vendor bills.
Original PR description
### Issue before this commit: Opening the Purchase Matching wizard would crash if the vendor bill contained lines with a description and a Unit of Measure (UoM), but no product selected. ### Steps to…
### Issue before this commit: Opening the Purchase Matching wizard would crash if the vendor bill contained lines with a description and a Unit of Measure (UoM), but no product selected. ### Steps to reproduce the issue: 1. Enable Units of Measure in Settings 2. Create and confirm a Vendor Bill setting a description and a UoM, but leave the Product field empty. 3. Click on "Purchase matching" smart button 4. The system throws a traceback with the error: "The unit of measure Unit defined on the order line doesn't belong to the same category as the unit of measure False defined on the product." ### Cause of the issue: In the purchase.bill.line.match model, the field product_uom_qty was computed by calling _compute_quantity using line.product_uom_id. Since product_uom_id is a related field on product_id.uom_id, it returns False when no product is set. The UoM conversion logic cannot handle a False destination category, leading to the crash. ### Reason to introduce the fix: Make purchase matching robust when imported vendor bills contain lines identified only by their description and not by a product. Note that for `purchase.bill.line.match` corresponding to an account.move.line but not related to any product, the `product_uom_qty` should match the quantity of the `aml_id` instead of attempting a UoM conversion based on a missing product UoM for the behavior to be consistent with the inverse method: https://github.com/odoo/odoo/blob/59d6232979b8499fde6cb700df1870e2e38d0d3e/addons/purchase/models/purchase_bill_line_match.py#L45-L54 opw-5911526 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#266899 Forward-Port-Of: odoo/odoo#257827
This update resolves a problem where users authenticating with standard Polish certificates were incorrectly rejected. The change expands the certificate matching logic to correctly identify certificate types, restoring functionality for existing customers and ensuring continued support for new users. This prevents authentication errors related to KSeF compliance.
Original PR description
### Description of the issue/feature this PR addresses: **Issue:** A recent update to support `certificateFingerprint` introduced a regression for existing users authenticating with standard…
### Description of the issue/feature this PR addresses: **Issue:** A recent update to support `certificateFingerprint` introduced a regression for existing users authenticating with standard certificates (AKA `certificateSubject`). Because the matching logic strictly checked for the company NIP within the certificate subject, it failed for users using personal PESEL certificates to act on a company's behalf. **Previous PR:** https://github.com/odoo/odoo/pull/264851 **Solution:** Expanded the string-matching heuristic in the XML signer to strip formatting characters from the NIP and explicitly checks for standard Polish qualified certificate prefixes (VATPL and PNOPL) to accurately get the identifier type. ### Current behavior before PR: When a user logs in via a personal PESEL certificate for a company context, the NIP check fails and miscategorizes the payload as a `certificateFingerprint`. KSeF rejects this mismatch, causing a 400 error for previously working setups. ### Desired behavior after PR is merged: The authentication flow distinguishes between `certificateSubject` and `certificateFingerprint` by checking for valid Polish prefixes or exact cleaned NIP matches. Existing customers are restored to working order natively, and new customers using manual fingerprints are still supported without requiring any database or UI changes. opw-6251153 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#267060
This update optimizes a key report that calculates historical inventory values. The change adds indexes to a database table, significantly speeding up the report generation process. Previously, the report was extremely slow due to inefficient database searches, but now it completes much faster.
Original PR description
The Inventory Valuation report at a past date rebuilds historical value by tracing stock moves. Two product.value lookups run on the hot path and both hit unindexed columns: -…
The Inventory Valuation report at a past date rebuilds historical value by tracing stock moves. Two product.value lookups run on the hot path and both hit unindexed columns: - stock.move._get_manual_value() searches product.value by move_id for every traced move; - product.product._get_last_product_value() searches product.value by product_id. product.value declares neither column with an index, so each lookup performs a sequential scan of the whole table. This is harmless on small tables but degrades sharply as product.value grows (one row is written per manual standard-price/move revaluation). On a database where product.value held ~9.6M rows, the per-move move_id lookup seq-scans the entire table only to return nothing (no row carries a move_id), repeated for every traced move, so the historical report never completes. Index product_id (dense) and move_id (btree_not_null, since it is null for every manual revaluation row). Each lookup then becomes an index scan. Measured on a ~9.6M-row product.value, historical valuation report, single date: | product.value lookup | without index | with index | | --------------------------- | ------------------------- | ------------------ | | by product_id (DISTINCT ON) | ~0.56s (1.7 GB seq scan) | index scan | | by move_id, per traced move | full seq scan, returns 0 | index scan | | report (~3.1M moves traced) | never completes (>20 min) | completes (~3 min) | --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#266790
This update resolves an issue where invoices with duplicate product entries would generate an error, preventing proper invoice creation. The fix automatically sums the quantities of the same product across multiple invoice lines, ensuring accurate invoice processing. This improves invoice accuracy and prevents disruptions to the invoicing workflow.
Original PR description
## Steps to Reproduce: 1. Install the **Invoicing** module. 2. Create a new product. 3. Create a new invoice and make the **Product** column visible in invoice lines. 4. Add the same product in two different invoice lines. 5. Click the **Catalog** button on the invoice lines. ## Error: `ValueError - Expected singleton: account.move.line(2, 3)` ## Cause: The method `_get_product_catalog_lines_data()` can receive multiple invoice lines for the same product when it appears more than once in the invoice. In this case, directly accessing quantity [1] on a multi-recordset raises an error. ## Fix: This commit sums up all line quantities for the same product. [1] - https://github.com/odoo/odoo/blob/61765c4ffc385402b02054fd6777c95d02f936e8/addons/account/models/account_move_line.py#L3875-L3884 sentry-7497160662
This update resolves an issue preventing AI Live Chat responses from being correctly delivered when embedded on other websites. The fix changes how the AI stream is accessed, ensuring it adheres to security protocols and receives the necessary data. This enhances the overall reliability and performance of the embedded AI Live Chat feature.
Original PR description
AI livechat embedded on another origin could not receive AI responses. The response stream is requested with fetch(), so it bypassed the livechat CORS routing that only wraps RPC calls. The matching CORS controller was also exposed as JSON-RPC, which cannot return the streamed HTTP response correctly. Expose the CORS endpoint as an HTTP stream, route the embedded fetch call to it, and pass the livechat guest token explicitly. task-id-6201054 Forward-Port-Of: odoo/enterprise#117535
This update fixes an issue where overtime was incorrectly reducing the displayed remaining time in the MO kanban view. The change ensures that the kanban header accurately reflects the actual remaining workload by ignoring previously consumed overtime values. This improves the accuracy of workload reporting.
Original PR description
Issue before this PR:- ======================== Currently, the total remaining time in the MO kanban header is computed by directly summing the `remaining_time` of all manufacturing orders in the…
Issue before this PR:- ======================== Currently, the total remaining time in the MO kanban header is computed by directly summing the `remaining_time` of all manufacturing orders in the column. This also includes overtime (negative remaining time), which incorrectly reduces the actual remaining workload. Steps to reproduce: ======================== 1) Install the `mrp_workorder` module. 2) Create 2 MOs with a work order. 3) Start the work order and wait until the real duration exceeds the expected duration (`real duration > expected duration`). 4) Pause the work order and open the MO kanban view. 5) Observe that the negative remaining time is shown in the column header. Cause of the issue: ======================== The `groupAggregate` method in the `MrpProductionKanbanHeader` component directly sums all `remaining_time` values, including negative ones. Since negative values represent overtime that has already been consumed, they should not reduce the future workload displayed in the kanban header. After this PR: ======================== This PR updates the method to treat negative remaining time as `0` when computing the total remaining time, ensuring that the kanban header correctly reflects the remaining future workload. TaskId:- 6226535
This update fixes an issue where manually added analytic distributions on purchase orders were lost when the line's account was changed. Now, when a purchase order line's account is updated, the associated analytic distribution remains intact, ensuring accurate tracking of costs. This prevents data inconsistencies and simplifies reporting for users managing purchase invoices.
Original PR description
__ ## Short functional explanation of the error When confirming a Purchase Order holding lines with an analytic distribution that has been manually added, and creating a vendor bill out of this PO…
__ ## Short functional explanation of the error When confirming a Purchase Order holding lines with an analytic distribution that has been manually added, and creating a vendor bill out of this PO using the Auto-Complete field. When we change the account of that line, the line loses the manually added Analytic Distribution. ## Reproduction Steps 1. Go to Accounting. Click on the tab Configuration; under the Analytic Accounting section, click on Analytic Distribution Models. 2. Create an Analytic Distribution Model for a product. 3. Go to Purchase. Create a new PO, set a Vendor and select the product you created the Analytic Distribution Model for. On the right side of the form, click on the view menu and check Analytic Distribution to make it appear. 4. Click on the Analytic Distribution of the product and add a new one; for example, select Administrative in the Departments section. 5. Confirm order. 6. Go to Accounting and click on the Vendors tab > Bills. Create a new bill, and in the field Auto-Complete, select the PO you just created. 7. Change the account of the line. ### Expected behavior Only the account should be changed on the line. ### Unexpected behavior The manually added Analytic Distribution has disappeared. ## Origin of the issue When we change the `account_id` field, the compute method `_compute_analytic_distribution` is triggered. This method retrieves the related distributions of the line: https://github.com/odoo/odoo/blob/af32885ec5f07d492f3b8e8fff1785996a739f72/addons/account/models/account_move_line.py#L1154 which, in the context of Purchase, calls this method: https://github.com/odoo/odoo/blob/af32885ec5f07d492f3b8e8fff1785996a739f72/addons/purchase/models/account_invoice.py#L540-L545 We retrieve the distribution of the related line using `self.purchase_line_id.analytic_distribution`. However, this code isn't triggered when the move line has an analytic distribution, even though the related line `purchase_line_id` might have one! Therefore, we need to execute that code whether or not our move line has an analytic distribution. Note: the same behavior is to avoid when creating invoices for quotations. __ opw-6062466 Forward-Port-Of: odoo/odoo#267274 Forward-Port-Of: odoo/odoo#258380
This update resolves an error that occurred when opening payslips with multiple attachments. The fix prevents a duplicate record issue that arose when deleting related documents, ensuring payslips can be opened reliably. This improves the user experience for managing payroll documents.
Original PR description
Currently, an error occurs when a user opens a payslip. **Steps to Reproduce:** - Install the `documents_hr_payroll` module. - Go to `Payroll` > `Payslips` > `Payslips` and open an `existing payslip`…
Currently, an error occurs when a user opens a payslip. **Steps to Reproduce:** - Install the `documents_hr_payroll` module. - Go to `Payroll` > `Payslips` > `Payslips` and open an `existing payslip` or `create a new one`. - Add `two or more attachments` to the payslip. - Go to `Documents` and, in the left panel, navigate to `Company` > `Employees - YourCompany` > `Payroll YourCompany`, then `Move to Trash` all documents related to those `payslip attachments`. - Go back to `Payslips` and open the `same payslip` again. `ValueError: Expected singleton: hr.payslip(4, 4)` With [this commit], the attachment's "Add to Document" action allows creating a Document from a mail.thread record attachment. When the user deletes the documents related to the attachments and then opens the payslip again, the compute method runs to calculate the linked document ID for the payslip attachments and tries to retrieve attachments without documents [1]. The issue occurs when two or more attachments share the same payslip ID. While mapping the res_id of the attachments and grouping them by ID, the same payslip record is included multiple times for a single key [2] [3], which raises error here [4]. This commit ensures that the mapped res_id values are wrapped in a set, so duplicate IDs are removed and each payslip ID appears only once. [this commit]: https://github.com/odoo/enterprise/commit/5fa4b74a2345ddd4858585c5e9a780d1ca5add57 [1]- https://github.com/odoo/enterprise/blob/21477b333f7a33cb582cd806236e4f9f8346d022/documents/models/ir_attachment.py#L26 [2]- https://github.com/odoo/enterprise/blob/21477b333f7a33cb582cd806236e4f9f8346d022/documents/models/ir_attachment.py#L45 [3]- https://github.com/odoo/enterprise/blob/21477b333f7a33cb582cd806236e4f9f8346d022/documents/models/ir_attachment.py#L48 [4]- https://github.com/odoo/enterprise/blob/21477b333f7a33cb582cd806236e4f9f8346d022/documents_hr_payroll/models/hr_payslip.py#L74-L76 sentry-7494229711
This update significantly improves the performance of the VAT Books ES report by processing invoices in batches instead of loading everything into memory at once. This prevents memory issues and crashes when generating reports for large invoice volumes, resulting in faster report generation times.
Original PR description
### Description of the issue/feature this PR addresses: This PR introduces batch processing to the VAT Books ES (Libros de IVA) report generation. When attempting to export the report for periods…
### Description of the issue/feature this PR addresses: This PR introduces batch processing to the VAT Books ES (Libros de IVA) report generation. When attempting to export the report for periods containing a massive volume of invoices, the ORM cache continuously accumulates records, leading to severe memory consumption. By implementing batching and explicitly clearing the environment cache, use memory use will remain stable and efficient. ### Current behavior before PR: Generating the VAT Books report loads all account move lines into memory at once. Because the ORM cache is never cleared during the iteration, RAM usage spikes continuously. On databases with tens or hundreds of thousands of invoices in a single period, this leads to significant performance degradation, worker timeouts, or complete Out-Of-Memory (OOM) crashes. ### Desired behavior after PR is merged: The report engine now splits the recordset into manageable batches (e.g., 50,000 accounts per batch). After processing each chunk to extract the income and expense line values, invalidate_model() is called to flush the ORM cache related to the searched records. This frees up memory continuously, keeping the server's RAM usage flat and allowing the successful export of massive datasets without crashing. ### Benchmark: The model is iterating through ~1.1M account move lines when generating the full report. For Memory: | # Input Data | Before PR | After PR| | -------- | -------- | -------- | | ~77,000 account move lines | 385 MB | 666 MB | | ~340,000 account move lines |1.2 GB | 1.5 GB | | ~1.2M account move lines | MemoryError | 1.5 GB | For Speed: | # Input Data | Before PR | After PR| | -------- | -------- | -------- | | ~77,000 account move lines | 32s | 12s | | ~340,000 account move lines | 2:29min | 1:11min | | ~1.2M account move lines | MemoryError | 4:11min | ### Reference opw-6037414 ----------------------------------------------------------------- I confirm I have signed the CLA and read the PR guidelines at [www.odoo.com/submit-pr](http://www.odoo.com/submit-pr) Forward-Port-Of: odoo/enterprise#116139