Repository navigation
[FIX] delete_records_safely_by_xml_id childs by record._name - #455
sergiocorato wants to merge 1 commit into
Conversation
|
/ocabot merge nobump |
|
On my way to merge this fine PR! |
pedrobaeza
left a comment
There was a problem hiding this comment.
I think the solution is to restrict that search to views, as if not, they won't have that field anyway. And document everything. Another option is to include the parent field name as optional.
| @@ -3636,7 +3636,7 @@ def delete_records_safely_by_xml_id(env, xml_ids, delete_childs=False): | |||
| if not record: | |||
| continue | |||
| if delete_childs: | |||
There was a problem hiding this comment.
| if delete_childs: | |
| if delete_childs and record._name == "ir.ui.view": |
|
@pedrobaeza I disagree. any model that supports the child_of operator can profit from this. note this originates from a real use case in OCA/OpenUpgrade#5719 (comment) |
|
I think @pedrobaeza is concerned with |
|
ahh right. then this should indeed do inherit_id for ir.ui.view and id for the rest |
|
Not |
|
then we seem to differ about what this should do. for a generic model with a parent_id field, and entries id: 42 id: 43 I expect |
|
Yeah, that's it, both 42 and 43 will be removed. You point the parent record, and all the childrens recursively are removed. What I'm saying is that the |
Not exactly. To be truly recursive, the method |
|
Then the implementation is half-baked in my opinion, as I understand the use case about removing "this view and any descendant". Removing a view (or other record), and only the children may give error. |
|
I'm closing this in favor of the somewhat more advanced #466 |
No description provided.