odoo/odoo#158950
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:17.0-16.0-opw-3754297-recurring-order-with-option-change-plan-etvi-bSjT-fw
- head
- d3b3d1d835775706faa9493cdf8e46e90702cebe
- merged
- 1 year ago by Misc, Arnaud Joset (arj)
odoo/odoo | odoo/enterprise | |
---|---|---|
16.0 | #157515 | #58264 |
saas-16.3 | #158882 | #59270 |
saas-16.4 | #158917 | #59290 |
17.0 | #158950 | #59301 |
saas-17.1 | #159628 | #59614 |
saas-17.2 | #159661 | #59628 |
18.0 | ||
saas-18.1 | ||
saas-18.2 | ||
saas-18.3 | ||
saas-18.4 | ||
master | #159687 | #59651 |
[FW][FIX] sale_management: dispense temp cache records
Current behavior:
If a recurring sale order has an associated sale order option and the recurring plan of the order is changed, a trace back occurs.
Expected behavior:
The recurring plan can be changed as it ordinarily would.
Steps to reproduce:
1. Add a recurring product to a sale order
-
Add an optional recurring product to the order
-
Try to change the recurring plan of the order to encounter the trace back
Cause of the issue:
This flow causes some 'phantom' sale order lines to have their price recalculated (phantom because they have no price, qty, currency, nor order_id field values). During this recalculation a currency_id is expected either in the line itself or in the sale order it is a part of. Because there is no value for either of these, it fails the ensure_one() method in the sequence (0 vals, expects 1).
The phantom lines are created in the sale.order.option
model in the sale_management
module, in _compute_price_unit()
and _compute_discount()
.
Fix:
Call invalidate_recorset(flush=False)
on these cached records at the end of the methods in which they are created.
Test added in odoo/enterprise#58264
Forward-Port-Of: #157515