Skip to content

[17.0][FIX] auditlog: registry propagation - #3088

Merged
OCA-git-bot merged 2 commits into
OCA:17.0from
gurneyalex:auditlog-fix-registry-propagation
Oct 23, 2024
Merged

OCA-git-bot merged 2 commits into
OCA:17.0from
gurneyalex:auditlog-fix-registry-propagation

Conversation

@gurneyalex

Copy link
Copy Markdown
Member

When a new auditlog rule is added / modified / deleted, all workers need to be notified of the change. This is done through registry signaling. The previous code was not using the proper level of signaling resulting in workers not being aware of the changes and not implementing the correct auditlog rules, because they had only invalidated their cache and not reloaded the registry.

We fix this by using the same signaling as implemented in base_automation which sets the the registry_invalidated field of env.registry to True to cause a full registry reload.

@gurneyalex gurneyalex changed the title [FIX] auditlog: registry propagation [17.0][FIX] auditlog: registry propagation Oct 22, 2024
@gurneyalex gurneyalex added this to the 17.0 milestone Oct 22, 2024
When a new auditlog rule is added / modified / deleted, all workers
need to be notified of the change. This is done through registry
signaling. The previous code was not using the proper level of signaling
resulting in workers not being aware of the changes and not implementing
the correct auditlog rules, because they had only invalidated their
cache and not reloaded the registry.

We fix this by using the same signaling as implemented in
`base_automation` which sets the the registry_invalidated field of
env.registry to True to cause a full registry reload.
@gurneyalex
gurneyalex force-pushed the auditlog-fix-registry-propagation branch from b7cb436 to 56d1a1e Compare October 22, 2024 06:34
Comment thread auditlog/models/rule.py Outdated
@gurneyalex
gurneyalex force-pushed the auditlog-fix-registry-propagation branch from 20356ba to 5d2afc0 Compare October 22, 2024 06:53
Comment thread auditlog/models/rule.py
# this code comes from `base_automation` which has a similar need
if self.env.registry.ready and not self.env.context.get("import_file"):
# notify other workers
self.env.registry.registry_invalidated = True

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it something compatible on Odoo < 17.0 that should be backported?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems at least compatible with Odoo 16.0, didn't checked previous versions.

@sebalix

sebalix commented Oct 23, 2024

Copy link
Copy Markdown
Contributor

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 17.0-ocabot-merge-pr-3088-by-sebalix-bump-patch, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit 94d1f29 into OCA:17.0 Oct 23, 2024
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at b26d775. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants