server-tools icon indicating copy to clipboard operation
server-tools copied to clipboard

Cannot delete Auditlog Rules

Open BT-shautz opened this issue 3 years ago • 2 comments

Module

Auditlog

Describe the bug

An error is triggered when trying to delete an Auditlog Rule, this error isn't always triggered and is quite inconsistent. The suspected cause is the deletion of the attrs added in the "_patch_methods" call, like "auditlog_ruled_create", that is done in the "_revert_methods" call with:

  • delattr(type(model_model), "auditlog_ruled_%s" % method)

And resulting in the following error message:

Traceback (most recent call last):
  File "/home/odoo/repos/odoo/odoo/http.py", line 639, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/repos/odoo/odoo/http.py", line 315, in _handle_exception
    raise exception.with_traceback(None) from new_cause
AttributeError: auditlog_ruled_unlink

To Reproduce

Affected versions: We could reproduce this on Odoo v14 and v15, other versions might be affected as well.

Steps to reproduce the behavior:

  1. Create an Audit Rule
  2. Attempt to delete it.
  3. Sometimes the above mentioned error is triggered.

Expected behavior The Rule is deleted with no errors (the added attributes are removed accordingly).

BT-shautz avatar Dec 21 '22 10:12 BT-shautz

Further info regarding this issue: The new attributes were created through sudo(), if the delattr() is called with self.sudo() as well the deletion doesn't trigger an error anymore.

BT-shautz avatar Apr 28 '23 12:04 BT-shautz

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Oct 26 '25 12:10 github-actions[bot]