Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] util/records: fix delete_unused DOCSTRING
Browse files Browse the repository at this point in the history
`delete_unused`, in spite of its name, deletes records even if they are used,
provided they are not part of a foreign key with `restrict` or `set` ondelete
clause (iow: allowing for cascading foreign keys).
Pirols committed Jun 19, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
Pirols Edoardo Piroli
1 parent 5f83f3a commit 0675a6a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/util/records.py
Original file line number Diff line number Diff line change
@@ -1098,10 +1098,13 @@ def add_ref(ref):

def delete_unused(cr, *xmlids, **kwargs):
"""
Remove unused records.
Remove unrestricted records.
This function will remove records pointed by `xmlids` only if they are not referenced
from any table.
This function will remove records, pointed by `xmlids`, only if they are NOT referenced
from any table with `restrict` or `set` ondelete clauses.
.. warning::
Indirect references are not checked and can cause the util to fail.
.. note::
The records that cannot be removed are set as `noupdate=True`.

0 comments on commit 0675a6a

Please sign in to comment.