Skip to content
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

Closed

Conversation

victoralmau
Copy link
Member

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

@pedrobaeza pedrobaeza added this to the 13.0 milestone Jul 6, 2021
@pedrobaeza
Copy link
Member

@keshrath @etobella what do you think about this change of behavior, based on the feedback given by our users, saying that it's very confusing to see all subfolders each time.

Comment on lines +685 to +712

@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
)
Copy link
Member

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?

Copy link
Member

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.

@victoralmau
Copy link
Member Author

I close this because this idea is included in #117

@pedrobaeza pedrobaeza deleted the 13.0-fix-dms-subdirectories_in_view branch August 8, 2023 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants