Repository navigation
[18.0][FIX] sale_elaboration_margin: don't leave the temporary line pending to recompute - #290
Conversation
… to recompute To get the elaboration price, a temporary sale order line is created for the elaboration product and detached from the order afterwards. Detaching it flags its stored computed fields to be recomputed, and nothing ever computes them, so they remain pending in the environment. The next time one of those fields is read on a real line, the pending temporary line is computed in the same batch. As it has no order, it has neither company nor currency, so any compute method relying on the currency of the line fails with "Expected singleton: res.currency()". This happens for example when selecting a product in a sale order line and the elaboration is filled automatically. Now the pending computations of the temporary line are discarded once the price is obtained.
rrebollo
left a comment
There was a problem hiding this comment.
Ran the module's tests on 18.0 after installing it in a throwaway database: green, and the new regression test fails on the base revision, so the leak is pinned. I reproduced the pending computations on the discarded line but not the Expected singleton: res.currency() itself, which needs more than a bare sale + sale_elaboration stack.
When you have a moment, a review of #257 — the 17.0 backport of sale_margin_delivered_security — would be very welcome in return.
|
/ocabot merge patch |
|
@pedrobaeza The merge process could not start, because command |
|
This PR has the |
|
/ocabot merge patch |
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
Congratulations, your PR was merged at f918747. Thanks a lot for contributing to OCA. ❤️ |
To get the elaboration price, a temporary sale order line is created for the elaboration product and detached from the order afterwards. Detaching it flags its stored computed fields to be recomputed, and nothing ever computes them, so they remain pending in the environment.
The next time one of those fields is read on a real line, the pending temporary line is computed in the same batch. As it has no order, it has neither company nor currency, so any compute method relying on the currency of the line fails with "Expected singleton: res.currency()". This happens for example when selecting a product in a sale order line and the elaboration is filled automatically.
Now the pending computations of the temporary line are discarded once the price is obtained.
@Tecnativa TT64937
ping @carlosdauden @CarlosRoca13