[18.0][FIX] auditlog: swap out tocompute in ThrowAwayCache as well - #3407
Merged
OCA-git-bot merged 1 commit intoOct 8, 2025
Merged
Conversation
StefanRijnhart
force-pushed
the
18.0-auditlog-fix_field_computes
branch
from
October 6, 2025 13:02
52f6b80 to
462edf3
Compare
StefanRijnhart
force-pushed
the
18.0-auditlog-fix_field_computes
branch
from
October 6, 2025 13:47
462edf3 to
2c3042b
Compare
DavidJForgeFlow
approved these changes
Oct 6, 2025
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
18.0-auditlog-fix_field_computes
branch
from
October 6, 2025 14:26
2c3042b to
2c75742
Compare
espo-tony
approved these changes
Oct 6, 2025
LoisRForgeFlow
approved these changes
Oct 8, 2025
LoisRForgeFlow
left a comment
Contributor
There was a problem hiding this comment.
Looks good 👍 We have tested and indeed fixes the problem
Member
|
/ocabot merge patch |
Contributor
|
What a great day to merge this nice PR. Let's do it! |
Contributor
|
Congratulations, your PR was merged at c4c2b24. Thanks a lot for contributing to OCA. ❤️ |
Member
Author
|
Thanks for the quick follow-up. Can this one be merged as well? #3408 |
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.
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.