-
Notifications
You must be signed in to change notification settings - Fork 51
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
[IMP] util.delete_unused #205
[IMP] util.delete_unused #205
Conversation
2b1d4b3
to
ec5036f
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.
To be sure I understand:
We extend the delete_unused
method to take into account children of the record being removed. In effect if a child has a cascade removal it is fine to consider the parent unused as long a the child is also unused.
I still have mixed feelings bout this because how can we be sure it is a parent/child relationship? Maybe it is a same-table relation but not really a parent/child situation. I'd feel more reassured if at least we restrict to parent_id
columns :/
Just for the sake of ensuring we discuss it. If there is a parent/child relationship already present in the list of records to remove I think current approach is still correct.
This patch requires a small comment in the docs if we move forward.
The condition is same table + ondelete=cascade. I think it's enough to be considered to have a dependency between records.
It bite us in the upgrade of odoo.com to saas~18.1 with the deletion of product categories.
Obviously |
I was actually referring to the approach in this patch :) In other words I wanted to be sure that the presence of parent-child relationship in the input will work well with the new implementation added in this patch (wrongly referred as "current approach") |
ec5036f
to
aaf2732
Compare
f1e6dca
to
ee57780
Compare
ee57780
to
8717722
Compare
Also consider child records when searching for record usage. i.e. when try to remove a product category, also search for its sub categories as they will be cascade deleted if unused. Co-authored-by: Alvaro Fuentes <afu@odoo.com>
8717722
to
e97c25b
Compare
@robodoo r+ |
Also consider child records when searching for record usage.
i.e. when try to remove a product category, also search for its sub categories as they will be cascade deleted if unused.