New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FW][FIX] sale_management: dispense temp cache records #159661
[FW][FIX] sale_management: dispense temp cache records #159661
Conversation
This PR targets saas-17.2 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
@ethanrobv linked pull request(s) odoo/enterprise#59628 not ready. Linked PRs are not staged until all of them are ready. |
**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 2. Add an optional recurring product to the order 3. 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. opw-3754297 X-original-commit: c6842f1
db4e717
to
b7d3a36
Compare
@ethanrobv this PR was modified / updated and has become a normal PR. It should be merged the normal way (via @robodoo) |
@robodoo r+ |
**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 2. Add an optional recurring product to the order 3. 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. opw-3754297 closes #159661 X-original-commit: c6842f1 Signed-off-by: Vincent Ethan <etvi@odoo.com>
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:
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 thesale_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 https://github.com/odoo/enterprise/pull/58264
opw-3754297
Forward-Port-Of: #158950
Forward-Port-Of: #157515