diff --git a/external_file_location/abstract_task.py b/external_file_location/abstract_task.py index c9397318..ce98bd76 100644 --- a/external_file_location/abstract_task.py +++ b/external_file_location/abstract_task.py @@ -7,14 +7,12 @@ from base64 import b64encode class AbstractTask(object): def create_file(self, filename, data): - ir_attachment_id = self.env['ir.attachment'].create( - { - 'name': filename, - 'datas': b64encode(data), - 'datas_fname': filename, - 'task_id': self.task.id, - 'location_id': self.task.location_id.id, - 'external_hash': self.ext_hash - } - ) + ir_attachment_id = self.env['ir.attachment'].create({ + 'name': filename, + 'datas': b64encode(data), + 'datas_fname': filename, + 'task_id': self.task.id, + 'location_id': self.task.location_id.id, + 'external_hash': self.ext_hash + }) return ir_attachment_id diff --git a/external_file_location/attachment_view.xml b/external_file_location/attachment_view.xml index 0f083efa..b5f5309c 100644 --- a/external_file_location/attachment_view.xml +++ b/external_file_location/attachment_view.xml @@ -2,19 +2,19 @@ - - ir.attachment - - - - - - + + ir.attachment + + + + + + - - - + + + ir.attachment diff --git a/external_file_location/task.py b/external_file_location/task.py index 655e98ee..154e098a 100644 --- a/external_file_location/task.py +++ b/external_file_location/task.py @@ -36,7 +36,7 @@ class Task(models.Model): filepath = fields.Char() location_id = fields.Many2one('external.file.location', string='Location') attachment_ids = fields.One2many('ir.attachment', 'task_id', - string='Attachment') + string='Attachment') delete_file = fields.Boolean(string='Delete file') move_file = fields.Boolean(string='Move file') move_path = fields.Char(string='Move path') @@ -69,21 +69,21 @@ class Task(models.Model): def run(self): for cls in itersubclasses(AbstractTask): if cls._synchronize_type and \ - cls._key + '_' + cls._synchronize_type == self.method: - method_class = cls + cls._key + '_' + cls._synchronize_type == self.method: + method_class = cls config = { - 'host': self.location_id.address, - 'user': self.location_id.login, - 'pwd': self.location_id.password, - 'port': self.location_id.port, - 'allow_dir_creation': False, - 'file_name': self.filename, - 'path': self.filepath, - 'attachment_ids': self.attachment_ids, - 'task': self, - 'move_path': self.move_path, - 'delete_file': self.delete_file, - 'move_file': self.move_file, - } + 'host': self.location_id.address, + 'user': self.location_id.login, + 'pwd': self.location_id.password, + 'port': self.location_id.port, + 'allow_dir_creation': False, + 'file_name': self.filename, + 'path': self.filepath, + 'attachment_ids': self.attachment_ids, + 'task': self, + 'move_path': self.move_path, + 'delete_file': self.delete_file, + 'move_file': self.move_file, + } conn = method_class(self.env, config) conn.run()