This question has been flagged
2 Replies
3712 Views

I have config FTP in my local system. I have put one CSV file into one folder now I can get the CSV file and create the attachment to that CSV file so how can I attach that CSV file. I have some code about connect with FTP file.  but no idea how to get and attach in attachment or direct download that file


path = '/home/Demo/FTP/Test/'
filename = 'PE_20180727093212.csv'

ftp = ftplib.FTP("127.0.0.1")
ftp.login("demo", "demo")
ftp.cwd(path)
ftp.retrbinary("RETR " + filename, open(filename, 'wb').write)
ftp.quit()
Avatar
Discard

Did u find out the proper answer for how to attach the FTP file in odoo?

Best Answer

Hello Harshit,

you need to fetch the attach file from the FTP and store into the Attachment(ir.attachment object). Then you can download it directly

Avatar
Discard