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

[WIP][16.0][FIX] dms: fix directory actions #277

Draft
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

len-foss
Copy link

If the directory is empty, the action would return all files, and the panel show all directories except for the one that triggered the action.

The file count was not consistent with the action if the directory is hidden, since its files would thus also be hidden; this field is a related on the storage, so the value is consistent for the directory and all its files.

@pedrobaeza pedrobaeza added this to the 16.0 milestone Dec 18, 2023
dms/models/directory.py Outdated Show resolved Hide resolved
Copy link
Member

@victoralmau victoralmau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do something similar with the "Subdirectories" smart-button of the directory form view? That way, we will get the searchpanel to have set the folder we have clicked on so we can easily create a directory.

"type": "ir.actions.act_window",
"name": _("Files"),
"res_model": "dms.file",
"view_mode": "tree,form",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"view_mode": "tree,form",
"view_mode": "kanban,tree,graph,pivot,form",

@len-foss len-foss marked this pull request as draft December 18, 2023 14:54
@len-foss
Copy link
Author

@victoralmau

Can you do something similar with the "Subdirectories" smart-button of the directory form view? That way, we will get the searchpanel to have set the folder we have clicked on so we can easily create a directory.

So I checked the 4 cases, over (directory/files) and (child_of/direct).
It turns out only the case directory/direct works fully, which means that the correct domain is displayed, and the search panel is correctly set. In the directory/child_of case, the search panel is wrong.

Currently in both file cases the domain is wrong if there are no files. In the file/direct case, the domain is always wrong, but the search panel is correct.

With my proposed change, the domain is correct in all cases but the search panel is not. So it's slightly better but not a true fix. I'll try to look more in-depth at what happens to see if there's a true solution.

@len-foss
Copy link
Author

The previous approach was flawed I think, as the problem comes from the JS function _getCategoryDomain.

If you look at actions like action_dms_files_directory, the ("directory_id", "child_of", active_id) has been removed from the action domain in comparison with version 15.0. Why? Because if this domain is there, the search panel filters too much information to be able to display the proper hierarchy.
However this means it's _getCategoryDomain that automatically fills in the domain.
For files the issue is that it chooses the child_of operator even if the action is intended to be an =.
The current override is basically a hack to filter only top-level directories when coming from the main action.
However this hack is not able to distinguish when we come from other actions and that's what is messing the "subdirectories" action for instance.

So given the current code, _getCategoryDomain should get the current action as argument to decide how to modify the domain, but that's not the case. So, I think the override should be somewhere else where the info is available and can be passed down. I'm not familiar enough with the JS framework to know where, though.

@vancouver29 if you have any idea, let me know!

@len-foss len-foss changed the title [16.0][FIX] dms: fix directory files action [WIP][16.0][FIX] dms: fix directory actions Dec 19, 2023
@victoralmau
Copy link
Member

Related to #301

Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants