Daily updates from Odoo
Wednesday, July 15, 2026
1 change · 17.0
Resolved issues and error corrections
Subscriptions that include zero-price recurring products now correctly show delivered quantities as invoiced after an invoice is confirmed. This prevents subscriptions from incorrectly remaining marked as still to invoice, giving users a more accurate billing status.
Original PR description
Steps to reproduce: ---------------------------------------------- 1. Install Subscription module 2. Create two recurring products with the following configuration: * Type: Service * Invoicing…
Steps to reproduce:
----------------------------------------------
1. Install Subscription module
2. Create two recurring products with the following configuration:
* Type: Service
* Invoicing Policy: Delivered Quantities
* Set the Sales Price of one product to 0.0
3. Create and Confirm the Subscription having both products
4. Set a delivered quantity on both subscription lines
5. Create and confirm an invoice for the subscription
6. Check the Invoice status in the Other Info tab (Enable Debug mode)
Observation:
----------------------------------------------
1. Invoiced Quantity remains 0 for both products
2. Invoice status remains 'To Invoice' instead of 'Fully Invoiced'
Issue:
------------------------------------------------
`_compute_qty_invoiced` internally reads `order_id.next_invoice_date` (via `_get_subscription_qty_invoiced`) to determine the billing period window used to match invoice lines.
https://github.com/odoo/enterprise/blob/21c93f40f3367d3be77d2e78fdee1b7cb6449978/sale_subscription/models/sale_order_line.py#L176-L179 The problem is a timing issue during `_post()`.
1. `sale_subscription._post()` calls `super()._post()` which goes to `_generate_deferred_entries()`
2. For zero-price lines, all deferral moves have `amount_total = 0`, so they get unlinked
https://github.com/odoo/enterprise/blob/21c93f40f3367d3be77d2e78fdee1b7cb6449978/account_accountant/models/account_move.py#L304-L305
3. This unlink triggers an ORM flush which forces `_compute_qty_invoiced` to run NOW, but `next_invoice_date` hasn't been updated yet (it's still the start date)
4. With the stale `next_invoice_date`, the period window is wrong, so no invoice lines match → `qty_invoiced = 0`
5. Control returns to `sale_subscription._post()` which then updates `next_invoice_date` to the correct value, But `_compute_qty_invoiced` is never re-triggered because `next_invoice_date` is not in its `@api.depends`
Additionally, `_compute_invoice_status` unconditionally forces `invoice_status = 'no'` for any line with `price_subtotal == 0`, even after that line has been fully invoiced and delivered.
https://github.com/odoo/enterprise/blob/21c93f40f3367d3be77d2e78fdee1b7cb6449978/sale_subscription/models/sale_order_line.py#L63-L64
Solution:
------------------------------------------------
1. In `_post()`, after updating `next_invoice_date`, explicitly mark `qty_invoiced` for recomputation on recurring lines. This ensures it is recomputed with the correct `next_invoice_date` value
2. In `_compute_invoice_status`, add `and line.invoice_status != 'invoiced'` to the zero-price check so that once a zero-price line is fully invoiced (as determined by `super()`), it retains the 'invoiced' status instead of being overridden to 'no'.
Note:
----------------------------------------------
We cannot add `order_id.next_invoice_date` to the `@api.depends` of `_compute_qty_invoiced` because that would cause manual changes to `next_invoice_date` by users to incorrectly reset `qty_invoiced` to 0 (shifting the period window so existing invoice lines no longer match). This was the exact issue fixed by a prior commit that intentionally removed it from the dependencies.
https://github.com/odoo/enterprise/pull/65203/changes/e126a4008ef164b056b75031f2ec08aeb2bedd14
opw-5941955