[17.0][FIX] auditlog: swap out tocompute in ThrowAwayCache as well - #3408
Merged
OCA-git-bot merged 1 commit intoOct 8, 2025
Merged
Conversation
StefanRijnhart
force-pushed
the
17.0-auditlog-fix_field_computes
branch
2 times, most recently
from
October 6, 2025 14:27
983bbf9 to
4204f16
Compare
Steps to Reproduce: Install auditlog and purchase_tier_validation. Create an auditlog rule on the Tier Exception model. Create a new tier exception record for the purchase order model without any fields. In an export, check the value for the stored computed field `model_name`. Desired outcome: The value for `model_name` is 'purchase.order'. Actual outcome: There is no value for the stored computed field `model_name`. When trying to edit the `Fields` model, which depends on a valid value for this field, an error occurs saying 'Compute method failed to assign tier.validation.exception(1,).valid_model_field_ids'. Analysis: When `read` is executed under the scope of the new `ThrowAwayCache` decorator (OCA#3374), recomputes may be performed and dequeued from `self.env.cache.transaction.tocompute`. To make sure the recomputed values still end up in the non-volatile as well, we need to preserve the tocompute attribute from the original transaction.
StefanRijnhart
force-pushed
the
17.0-auditlog-fix_field_computes
branch
from
October 6, 2025 15:00
4204f16 to
21b6f27
Compare
pedrobaeza
approved these changes
Oct 8, 2025
pedrobaeza
left a comment
Member
There was a problem hiding this comment.
Fast-tracking as it has been merged for the rest of the branches:
/ocabot merge patch
Contributor
|
On my way to merge this fine PR! |
Contributor
|
Congratulations, your PR was merged at 39401b0. Thanks a lot for contributing to OCA. ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of #3407
Steps to Reproduce:
Install auditlog and purchase_tier_validation. Create an auditlog rule on the Tier Exception model. Create a new tier exception record for the purchase order model without any fields. In an export, check the value for the stored computed field
model_name.Desired outcome:
The value for
model_nameis 'purchase.order'.Actual outcome:
There is no value for the stored computed field
model_name. When trying to edit theFieldsfield, which depends on a valid value for this field, an error occurs saying 'Compute method failed to assigntier.validation.exception(1,).valid_model_field_ids'.
Analysis:
When
readis executed under the scope of the newThrowAwayCachedecorator (#3374), recomputes may be performed and dequeued fromself.env.cache.transaction.tocompute. To make sure the recomputed values still end up in the non-volatile as well, we need to preserve the tocompute attribute from the original transaction.