FTP Library Server Action
use ftp library from server action
FTP Library Server Action
use ftp library from server action
STORY BEHIND THE FEATURES
ODOO BEHAVIOR
Server action work on a base model and offer various type of actions that can be executed automatically, for example using base action rules, of manually, by adding the action in the ‘More’ contextual menu.
CLUEDOO BEHAVIOR
This module help you use ftp library from server action
MODULE +
CLUEDOO RECOMMENDATIONS
HOW TO USE THIS MODULE
1
Need to have FTP or SFTP Server. In this example I'll use https://sftpcloud.io/tools/free-sftp-server to help with the testing. Another tool is FIlezilla. Can also use some other tools.
2. Create server action in Odoo. Model Server Action. Credentials is also from sftpicloud.io.
FTP :
credentials = {
"user":"b90e2e4d0d87418ca13e8270e037563c",
"passwd": "wCu1KgHuqkUTXgwwVpp35M16IILxCSCW",
"host": "eu-central-1.sftpcloud.io",
"port": 21
}
filepath = "/"
filename = "rayn.exp"
filecontent = "12345543233234"
ftpSendFile(filepath,filename,filecontent,credentials)
SFTP:
credentials = {
"user":"27286e5f52b5493b99ba8d8ea384468e",
"passwd": "9rLt7OpSXfaZSjxS1yIjEm8rYWWZ1ioH",
"host": "eu-central-1.sftpcloud.io",
"port": 22
}
filepath="/test"
tz = env.user.tz
datenow_timezone = datetime.datetime.now().astimezone(timezone(tz))
filename = 'MAISON_STELLA_ET_SUZIE_VTE_'+'QUOT_'+str(datetime.date.today()).replace('-','')+'_'+str(datenow_timezone.strftime('%H%M'))+'.txt'
sftp = sftpConnect(credentials)
sftpPutTextFile(sftp,"testt",filepath,filename)
3.
Copy and paste the credentials from sftpcloud.io into filezila and then Quickconnect. If it's successful, the file willl be transferred. In this example, the file rayn.exp or MAISO_STELLA files are transferred.
Note: It may be display like this.