Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] auditlog: prevent creating logs without log lines #2907

Closed
wants to merge 1 commit into from

Conversation

AungKoKoLin1997
Copy link
Contributor

This PR enhances the change detection logic in the write_full and write_fast methods to ensure logs are only generated when significant data changes occur. Previously, compute functions could trigger logging even without actual data modifications, leading to logs that lacked corresponding log lines. This update prevents such redundant logging, optimizing performance and maintaining cleaner log records.

@qrtl QT4483

This commit enhances the change detection logic in the write_full and write_fast methods
to ensure logs are only generated when significant data changes occur. Previously, compute
functions could trigger logging even without actual data modifications,
leading to logs that lacked corresponding log lines. This update prevents such redundant logging,
optimizing performance and maintaining cleaner log records.
Copy link

@kanda999 kanda999 left a comment

Choose a reason for hiding this comment

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

Functional review: LGTM

@AungKoKoLin1997
Copy link
Contributor Author

@oca-server-tools-maintainers
Can you please take a look this PR?

Comment on lines +404 to +409
changes = any(
old_values[rec_id] != new_values[rec_id]
for rec_id in self.ids
if rec_id in old_values and rec_id in new_values
)
if not changes or self.env.user in users_to_exclude:
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Suggested change
changes = any(
old_values[rec_id] != new_values[rec_id]
for rec_id in self.ids
if rec_id in old_values and rec_id in new_values
)
if not changes or self.env.user in users_to_exclude:
if new_values == old_values or self.env.user in users_to_exclude:

result = write_fast.origin(self, vals, **kwargs)
if self.env.user in users_to_exclude:
if not changes or self.env.user in users_to_exclude:
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Please check if this doesn't skip log creation when a value is changed to false from something else.

@AungKoKoLin1997
Copy link
Contributor Author

This improvement is not valid. I misunderstood compute function behavior and confused. Closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants