I'm developing a module that uploads specific files via ssh to specific server based on customer creation:
class ResPartner(models.Model): _name = 'res.partner' _inherit = 'res.partner' @api.model def create(self, vals): if vals: testfile=open("/tmp/diegotexting.txt", "w") testfile.write("Hi, testing odoo 9 ") ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect("foo.org", username="foo", password="foo") sftp = ssh.open_sftp() sftp.put("/tmp/diegotexting.txt", "/tmp/diegotexting.txt") sftp.close() ssh.close() return super(ResPartner, self).create(vals)
It does upload the file in server "foo.org", the problem is that when I open it, it's blank.
I have tested the upload script outside of odoo enviroment and works well(it doesn't show a blank file).
Does anyone know what could be wrong?