Skip to Content
Menu
This question has been flagged
1 Reply
254 Views

Hi,

I'm trying to develop a simple odoo 18 community app for our internal use. The app is for managing files from a range of our activities. The files are stored on an external NAS drive and are frequenctly accessed by different people, odoo users and non-odoo users. In general users open, edit and save the files through a Windows mapped drive or directly using \\servername\folder\filename.ext naming. I would like to store a reference (server, path and filename or just full path) to a file within an model record and then be able to access/open the file through a form view on the client browser. Importantly, I do NOT want the file to be stored in the odoo system.

I have tried to use a button on the form that calls a python function which then returns the path in file://servername/folder/file.name format to the file as the 'utl' parameter for ir.actions.act_url. However, when I click the button odoo modifies the url to add the base_url to the start of the provided url and remove some of the required '/' character. The ir_actions.act_url action only seems to work if the provided url is http or https.


  1. How can I use ir.actions.act_url to open a url in file://servername/folder/filename.ext format?
  2. If ir.actions.act_url cannot be used for this, what is the correct or best method to open a file using file:// protocol from odoo?
  3. Alternatively, if file:// proptocl cannot be used, is there a way to open a file directly in a program (e.g. MS Word) on the client computer from a file path stored in an odoo record?
Avatar
Discard
Author

Thanks for the reply. Unfortunately your suggestion doesn't seem to work. I formulated a URL to open a file in MS Word according to the instructions in your message and tested it in Firefox. All OK and the file opens. However, when I use the same text in a fields.Char with the url widget, the widget doesn't respond and doesn't seem to open anything or give an error message. I also tried adding the text as the 'url' response from a button's python method. In this case the link passed to the client browser was the Odoo base_url with my MS-Word:ofe....... text added to the end. This is a similar problem to my previous tests where the odoo url handling will only work if the link is http/https or a link to a file in a subfolder to the Odoo base_url. 

I'm still looking for a solution and thinking possibly this may need to have the file path included in jasvascript on the client side. However, I'm not familiar enough with Odoo to know how to do this.

Best Answer

See of this method still works:

https://www.odoo.com/forum/help-1/can-a-user-click-a-link-to-open-microsoft-word-edit-the-document-save-it-etc-from-an-odoo-record-176277

Avatar
Discard