[18.0][FIX] auditlog: fix caching; [ADD] test_auditlog - #3374
Merged
OCA-git-bot merged 3 commits intoOct 1, 2025
Conversation
StefanRijnhart
force-pushed
the
18.0-auditlog-fix-cache_sanitation
branch
from
September 16, 2025 19:33
cc5a259 to
66bb147
Compare
StefanRijnhart
marked this pull request as ready for review
September 16, 2025 19:43
StefanRijnhart
force-pushed
the
18.0-auditlog-fix-cache_sanitation
branch
from
September 18, 2025 11:38
66bb147 to
6b80671
Compare
Though TransactionCase rolls back database changes, it does not call `unlink` on `auditlog.rule` records, meaning that `unsubscribe` is never called to unpatch model methods. This causes subsequent tests in other modules to unexpectedly execute patched methods. This commit adds the `AuditLogRuleCommon` test class in an attempt to identify and prevent patched methods from contaminating the test environment.
StefanRijnhart
force-pushed
the
18.0-auditlog-fix-cache_sanitation
branch
from
September 24, 2025 17:31
6b80671 to
4b164b5
Compare
DavidJForgeFlow
approved these changes
Sep 29, 2025
DavidJForgeFlow
left a comment
There was a problem hiding this comment.
Thanks for this fix, it works!
JoanSForgeFlow
approved these changes
Sep 30, 2025
Contributor
|
This PR has the |
LoisRForgeFlow
approved these changes
Oct 1, 2025
LoisRForgeFlow
left a comment
Contributor
There was a problem hiding this comment.
Thanks! 🎖️
/ocabot merge patch
Contributor
|
On my way to merge this fine PR! |
Contributor
|
Congratulations, your PR was merged at 233a622. Thanks a lot for contributing to OCA. ❤️ |
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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. After this fix, it seems a flush that seemed necessary in the 18.0 port of OCA#3374 can also be removed.
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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. After this fix, it seems a flush that seemed necessary in the 18.0 port of OCA#3374 can also be removed.
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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. After this fix, it seems a flush that seemed necessary in the 18.0 port of OCA#3374 can also be removed.
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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. After this fix, it seems a flush that seemed necessary before can also be removed.
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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.
Member
Author
|
See #3407 for an important fix for this change. |
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 2, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 2, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 2, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 2, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 2, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 4, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 4, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 4, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 4, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 11, 2026
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
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Jan 20, 2026
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.
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 #3371
Fix caching and add a dedicated test module to run tests on the accounting models.
Fixes creating credit notes with audit rules on account.move.line, writing taxes on products as a user that does not have access to all companies for which there are taxes on the product, and more.
Fixes #3308, #3224, #2561, #2554
Includes a port of #3364.