Skip to content

Commit 00b29ae

Browse files
committed
[FIX] util/records: fix delete_unused DOCSTRING
`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).
1 parent 5f83f3a commit 00b29ae

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: src/util/records.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1098,14 +1098,17 @@ def add_ref(ref):
10981098

10991099
def delete_unused(cr, *xmlids, **kwargs):
11001100
"""
1101-
Remove unused records.
1101+
Remove unrestricted records.
11021102
1103-
This function will remove records pointed by `xmlids` only if they are not referenced
1104-
from any table.
1103+
This function will remove records, pointed by `xmlids`, only if they are NOT referenced
1104+
from any table with `restrict` or `set` ondelete clauses.
11051105
11061106
.. note::
11071107
The records that cannot be removed are set as `noupdate=True`.
11081108
1109+
.. warning::
1110+
Indirect references are not checked and can cause the util to fail.
1111+
11091112
:param list(str) xmlids: list of xml_ids to check for removal
11101113
:param bool deactivate: whether to deactivate records that cannot be removed because
11111114
they are referenced, `False` by default

0 commit comments

Comments
 (0)