Hello,
To achieve the functionality you’ve described for Odoo v12, you can follow these steps:
- Create a new custom module in Odoo to add this feature.
- Add a new Python method in the model where the “Path Pratica” field is located. This method will handle opening the folder when the link is clicked.
from odoo import models, fields, api
import os
class YourModel(models.Model):
_inherit = 'your.model.name'
def open_folder(self):
path = self.path_pratica
if path:
try:
os.startfile(path)
except Exception as e:
raise Warning('An error occurred while opening the folder: {}'.format(e))
else:
raise Warning('No folder path specified.')
- Next, add a button on the form view of your model to invoke this function:
- (Optional) To make it appear like an underlined link, you may need to add some CSS styling to that button:
oe_link
Just replace 'your.model.name' with the correct model name where the “Path Pratica” field is located.
Once implemented, users should be able to click on the underlined button/link in Odoo’s form view which will then open a file explorer window allowing them to browse and interact with files within the specified directory.
Please let me know if you have any questions or need further assistance!
Same issue here.
Dit you resolve this?
I am also looking for this Harri Matero, did you solve this?