콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
4171 화면

I just want a button that opens a specific folder on my computer in file explorer (windows) or finder (apple), based on a setting in the user's form (windows or apple) and a char field (specifying the path) on the project record.

The following is what I was testing: 

based on this video :
https://www.youtube.com/watch?v=ROQoJrLZR98

In the project form I have a char variable "link"   (D:\OneDrive\10 PROJECTS)

In the user's form I have a selection field  "os_user" with selection of 'windows' or 'apple'.

I could create a server action with "execute python code" like this:
import os
if user.os_user == "windows":
    os.system('explorer')

else:  

    os.system('finder')
os.startfile(record.link)

But Odoo won't allow me to use "import os" in the server action.


Is there any other way to achieve the result? (beside making a custom module?)


PS if there is a solution for only windows or only apple, i would also be very gratefull!!!


thanks guys!


roeland

아바타
취소
베스트 답변

Maybe you can use the storage_backend module from OCA.

아바타
취소
관련 게시물 답글 화면 활동
1
1월 21
3424
1
10월 19
6463
0
7월 17
5785
2
10월 24
3892
0
9월 23
1234