-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
[13.0][FIX] dms: Show only real subdirectories in view and when we use searchpanel directory filter #109
[13.0][FIX] dms: Show only real subdirectories in view and when we use searchpanel directory filter #109
Conversation
…chpanel directory filter
|
||
@api.model | ||
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): | ||
""" | ||
It's necessary to prevent parent_id=False when searchpanel filter by directory | ||
and prevent auto-aplly ('parent_id','child_of',xx) domain because it is not | ||
expected for us (if we filter by Documents directory we expected view only | ||
subdirectories and not Documents directory), similar to computer filestore. | ||
""" | ||
if self.env.context.get("override_search_read") and len(domain) > 0: | ||
domain.reverse() | ||
domain2 = [] | ||
parent_id_override = False | ||
for item in domain: | ||
if item[0] == "parent_id" and item[1] == "child_of": | ||
domain2.append([item[0], "=", item[2]]) | ||
parent_id_override = True | ||
elif not parent_id_override or ( | ||
parent_id_override | ||
and not bool( | ||
item[0] == "parent_id" and item[1] == "=" and not item[2] | ||
) | ||
): | ||
domain2.append(item) | ||
domain = domain2 | ||
return super().search_read( | ||
domain=domain, fields=fields, offset=offset, limit=limit, order=order | ||
) |
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.
Why do you need to override this method? Doesn't [('parent_id', '=', False)]
return the top level directories already? Can't you just use that domain in the action?
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.
But shouldn't folders be shown according current subdirectory level? Thus it should be something like: parent_id = <current_subdirectory>
, being False
or other.
I close this because this idea is included in #117 |
Show only real subdirectories in view and when we use searchpanel directory filter.
Related to #40
Please @pedrobaeza and @yajo can you review it?
It's necessary to apply 14.0 too.
@Tecnativa TT30826