def _directory(self, name): """Return SFTPAttributes for a directory with given name""" result = SFTPAttributes() result.filename = name result.st_uid = 0 result.st_group = 0 result.st_size = 0 result.st_mode = stat.S_IFDIR | stat.S_IRUSR | stat.S_IXUSR return result
def _file(self, attachment): """Return SFTPAttributes for a given attachment""" if not hasattr(attachment, '_ids'): attachment = self.env['ir.attachment'].browse(attachment) result = SFTPAttributes() result.filename = attachment.datas_fname or attachment.name result.st_uid = 0 result.st_group = 0 result.st_size = attachment.file_size result.st_mode = stat.S_IFREG | stat.S_IRUSR return result