diff --git a/ir_exchange_file/.__openerp__.py.swp b/ir_exchange_file/.__openerp__.py.swp deleted file mode 100644 index 8d9e9bd5..00000000 Binary files a/ir_exchange_file/.__openerp__.py.swp and /dev/null differ diff --git a/ir_exchange_file/.attachment.py.swp b/ir_exchange_file/.attachment.py.swp deleted file mode 100644 index dc65a5c0..00000000 Binary files a/ir_exchange_file/.attachment.py.swp and /dev/null differ diff --git a/ir_exchange_file/.backend.py.swp b/ir_exchange_file/.backend.py.swp deleted file mode 100644 index 5afb768f..00000000 Binary files a/ir_exchange_file/.backend.py.swp and /dev/null differ diff --git a/ir_exchange_file/__init__.py b/ir_exchange_file/__init__.py deleted file mode 100644 index 046125d4..00000000 --- a/ir_exchange_file/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com). -# @author Sébastien BEAU -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################### - -import attachment -import location -import task - diff --git a/ir_exchange_file/__openerp__.py b/ir_exchange_file/__openerp__.py deleted file mode 100644 index 501f5ebf..00000000 --- a/ir_exchange_file/__openerp__.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com). -# @author Sébastien BEAU -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################### - -{'name': 'ir_exchange_file', - 'version': '0.0.1', - 'author': 'Akretion', - 'website': 'www.akretion.com', - 'license': 'AGPL-3', - 'category': 'Generic Modules', - 'description': """ - - """, - 'depends': [ - 'base', - ], - 'data': [ - 'attachment_view.xml', - 'location_view.xml', - 'task_view.xml', - ], - 'installable': True, - 'application': True, -} - - - - diff --git a/ir_exchange_file/attachment.py b/ir_exchange_file/attachment.py deleted file mode 100644 index fc1d479e..00000000 --- a/ir_exchange_file/attachment.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com). -# @author Sébastien BEAU -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################### - -from openerp import models, fields, api, _ -from openerp.exceptions import Warning -import hashlib - - -class AttachmentMetadata(models.Model): - _inherit = 'ir.attachment' - - sync_date = fields.Datetime() - parse_state = fields.Selection([ - ('pending', 'Pending'), - ('failed', 'Failed'), - ('done', 'Done'), - ], readonly=True, required=True, default='pending') - diff --git a/ir_exchange_file/attachment_view.xml b/ir_exchange_file/attachment_view.xml deleted file mode 100644 index 69cd719e..00000000 --- a/ir_exchange_file/attachment_view.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - ir.attachment - - - - - - - - - - - - diff --git a/ir_exchange_file/backend.py b/ir_exchange_file/backend.py deleted file mode 100755 index 7555f125..00000000 --- a/ir_exchange_file/backend.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - - -class AbstractConnection(object): - - def __init__(self, host, user, pwd, port=None, allow_dir_creation=False): - self.host = host - self.user = user - self.pwd = pwd - self.port = port - self.allow_dir_creation = allow_dir_creation - self.connection = None - - def connect(self): - return NotImplemented - - def close(self): - return NotImplemented - - def get(self, filename, path=None): - return NotImplemented - - def put(self, fileobject, filename, path=None): - return NotImplemented - - def search(self, filename, path=None): - return NotImplemented - - def move(self, filename, oldpath, newpath): - return NotImplemented - - def rename(self, oldfilename, newfilename, path=None): - return NotImplemented diff --git a/ir_exchange_file/backends/.filestore.py.swp b/ir_exchange_file/backends/.filestore.py.swp deleted file mode 100644 index 09405007..00000000 Binary files a/ir_exchange_file/backends/.filestore.py.swp and /dev/null differ diff --git a/ir_exchange_file/backends/filestore.py b/ir_exchange_file/backends/filestore.py deleted file mode 100755 index febd353b..00000000 --- a/ir_exchange_file/backends/filestore.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from ..backend import AbstractConnection -import sys -import os -from tempfile import TemporaryFile - -class AbtractTask() - - def __init__(self, cr, uid): - - - -class FileStoreConnection(AbstractTask): - _key = "filestore" - _name = "Filestore" - _synchronize_type = None - - def __init__(self, host, user, pwd, port=None, allow_dir_creation=False): - super(FilestoreConnection, self).__init__(host, user, pwd, port, allow_dir_creation) - - def connect(self): - return NotImplemented - - def close(self): - return NotImplemented - - def get(self, filename, path=None): - if path: - filepath = "{}/{}".format(path, filename) - else: - filepath = filename - return open(filepath, 'r+b') - - def put(self, fileobject, filename, path=None): - if path: - filepath = "{}/{}".format(path, filename) - else: - filepath = filename - output = open(filepath, 'w+b') - return True - - def search(self, filename, path=None): - if path: - filepath = "{}/{}".format(path, filename) - else: - filepath = filename - connection_list_result = os.listdir(filepath) - return [x for x in connection_list_result if filename in x] - - def move(self, filename, oldpath, newpath): - os.rename( - os.path.join(oldpath, filename), - os.path.join(newpath, filename) - ) - - def rename(self, oldfilename, newfilename, path=None): - return NotImplemented - -class ImportFileStore(FileStoreConnection): - _synchronize_type = "import" - - - def run(): - diff --git a/ir_exchange_file/backends/ftp.py b/ir_exchange_file/backends/ftp.py deleted file mode 100755 index 7316b81f..00000000 --- a/ir_exchange_file/backends/ftp.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - - -import sys -import os -from tempfile import TemporaryFile -from ftplib import FTP - -class FTPConnection(object): - - def __init__(self, host, user, pwd, port=None, allow_dir_creation=False): - super(FTPConnection, self).__init__(host, user, pwd, port, allow_dir_creation) - if not port: - self.port = 21 - self.protocol = "FTP" - - def connect(self): - self.connection = FTP(self.location, self.port) - self.connection.login(self.user, self.pwd) - - def close(self): - self.connection.close() - - def get(self, filename, path=None): - if path: - filepath = "{}/{}".format(path, filename) - else: - filepath = filename - outfile = TemporaryFile('w+b') - self.connection.retrbinary('RETR ' + filepath, outfile.write) - return outfile - - def put(self, fileobject, filename, path=None): - if path: - filepath = "{}/{}".format(path, filename) - else: - filepath = filename - self.connection.storbinary('STOR ' + filepath, fileobject) - return True - - def search(self, filename, path=None): - if path: - filepath = "{}/{}".format(path, filename) - else: - filepath = filename - connection_list_result = self.connection.nlst() - return [x for x in connection_list_result if filename in x] - - - def move(self, filename, oldpath, newpath): - self.connection.rename( - os.path.join(oldpath, filename), - os.path.join(newpath, filename) - ) - - def rename(self, oldfilename, newfilename, path=None): - return NotImplemented diff --git a/ir_exchange_file/backends/sftp.py b/ir_exchange_file/backends/sftp.py deleted file mode 100755 index 4d40b896..00000000 --- a/ir_exchange_file/backends/sftp.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import sys -import paramiko -import os -from tempfile import TemporaryFile - - -class SFTPConnection(AbstractConnection): - - def __init__(self, host, user, pwd, port=None, allow_dir_creation=False): - super(SFTPConnection, self).__init__(host, user, pwd, port, allow_dir_creation) - if not port: - self.port = 22 - self.protocol = "STFP" - - def connect(self): - self.ssh = paramiko.SSHClient() - self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - self.ssh.connect(self.host, self.port, self.user, self.pwd, compress=True) - self.connection = self.ssh.open_sftp() - - def close(self): - self.connection.close() - - def get(self, filename, path=None): - if path: - remotefile = "{}/{}".format(path, filename) - else: - remotefile = filename - localfile = filename - newfile = open(filename, 'w') - self.connection.getfo(remotefile, newfile) - return newfile - - def put(self, fileobject, filename, path=None): - if path: - remotefile = "{}/{}".format(path, filename) - else: - remotefile = filename - if self.allow_dir_creation: - self.connection.mkdirs(path) - oldfile = open(fileobj, 'r') - self.connection.putfo(oldfile, remotefile) - - def search(self, filename, path=None): - if path: - self.connection.chdir(path) - file_list = self.connection.listdir() - return [x for x in file_list if filename in x] - - def move(self, filename, oldpath, newpath): - self.connection.rename(os.path.join(oldpath, filename), os.path.join(newpath, filename)) - - def rename(self, oldfilename, newfilename, path=None): - if not path: - path = '' - self.connection.rename(os.path.join(path, oldfilename), os.path.join(path, newfilename)) diff --git a/ir_exchange_file/location.py b/ir_exchange_file/location.py deleted file mode 100644 index d82ef52b..00000000 --- a/ir_exchange_file/location.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com). -# @author Sébastien BEAU -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################### - -from openerp import models, fields - -class Location(models.Model): - _name = 'ir.location' - _description = 'Description' - - name = fields.Char(string='Name') - protocol = fields.Selection(selection='_get_protocol') - address = fields.Char(string='Address') - port = fields.Integer() - login = fields.Char() - password = fields.Char() - - - def _get_protocol(self): - return [('ftp', 'FTP'), ('sftp', 'SFTP'), ('filestore', 'Filestore')] - diff --git a/ir_exchange_file/location_view.xml b/ir_exchange_file/location_view.xml deleted file mode 100644 index c4d4ffcf..00000000 --- a/ir_exchange_file/location_view.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - ir.location - -
- - - - - - - - - - - -
-
-
- - - ir.location - - - - - - - - - - - - - - Locations - ir.actions.act_window - ir.location - form - - - - - -
-
diff --git a/ir_exchange_file/task.py b/ir_exchange_file/task.py deleted file mode 100644 index c632ec6c..00000000 --- a/ir_exchange_file/task.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# -# Module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com). -# @author Sébastien BEAU -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################### - -import sys -from openerp import models, fields - -class Task(models.Model): - _name = 'ir.location.task' - _description = 'Description' - - name = fields.Char() - method = fields.Selection([ - ('ftp_import', 'FTP import'), - ('ftp_export', 'FTP export'), - ('sftp_import', 'SFTP import'), - ('sftp_export', 'SFTP export'), - ('filestore_import', 'Filestore import'), - ('filestore_export', 'Filestore export'), - ]) - filename = fields.Char() - filepath = fields.Char() - location_id = fields.Many2one('ir.location', string='Location') - - def run(self): - connection_class = ... - - method_class = getattr(sys.modules[__name__], self.method) - conn = method_class(config) - conn.run() diff --git a/ir_exchange_file/task_view.xml b/ir_exchange_file/task_view.xml deleted file mode 100644 index b8e928b1..00000000 --- a/ir_exchange_file/task_view.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - ir.location.task - -
- - - - - - - - -
-
-
- - - ir.location.task - - - - - - - - - - - - Tasks - ir.actions.act_window - ir.location.task - form - - - - - -
-