-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
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.
bb37332
to
19f6dd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional review: LGTM
@oca-server-tools-maintainers |
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
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.
This improvement is not valid. I misunderstood compute function behavior and confused. Closing this PR. |
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