Closed aitorbouzas closed 6 years ago
So I see two possibilities that could work:
1) You can try to manipulate the domain to display only the desired folders. See also [1]
2) The load
function can already get a node as argument. Then the _loadInitialData
function shouldn't be called and _loadNode
function is called directly. See also [2]
I haven't toyed with it myself yet, but will probably be working on something like this myself in the next few days, as we have a similar requirement in a customer project. So if you come to a result it would be great if you could share your approach. Otherwise I might be able to tell you more when I've done it myself.
Basically the TreeView realatliv is easy to integrate. See also [3]
[1] https://github.com/muk-it/muk_dms/blob/11.0/muk_dms/static/src/js/views/documents/dms_documents_base_model.js#L109 [2] https://github.com/muk-it/muk_dms/blob/11.0/muk_dms/static/src/js/views/documents/dms_documents_base_model.js#L49 [3] https://github.com/muk-it/muk_dms/blob/11.0/muk_dms/static/src/js/chrome/dms_selection_file_dialog.js
Ok, thanks for the help. Maybe we'll workaround with the kanban view instead of using the document viewer. If not, i'll try to do something with the tips you gave me and i'll come back later to tell you the results. If you manage to make it, please share your approach too.
Thanks :)
Okay, it's actually quite simple.
You can easily add initial data. I had already completely forgotten that I had implemented this.^^
Sample snippet:
var data = $.Deferred();
var init_data = [{
id: "directory_1",
text: "Documents",
icon: "fa fa-folder-o",
type: "directory",
data: {
odoo_id: 1,
odoo_model: "muk_dms.directory",
},
children: true,
}];
data.resolve(init_data);
var params = {
dnd: true,
contextmenu: true,
model: {
noSettings: true,
init_data: data,
}
};
this.controller = new DocumentsViewController(this, DocumentsModel, DocumentsRenderer, view_params);
Sorry for reopening this. I understand the snippet, but is there a way to do this with an Odoo's action? Like create a button that returns an action or something and pass the directory with a param?
Check #62 ! I'm a total newbie, but managed to do something :heart:
Hi there,
First of all thank you very much for the marvelous free software you offered to the Odoo community. I'm creating an issue to ask a question: Is there an easy way to create an action that opens de Document viewer with a specific folder opened? Any workaround we could do or something?
Thank you.