diff --git a/external_file_location/__openerp__.py b/external_file_location/__openerp__.py index dceaa847..8d286d4e 100644 --- a/external_file_location/__openerp__.py +++ b/external_file_location/__openerp__.py @@ -28,7 +28,7 @@ 'license': 'AGPL-3', 'category': 'Generic Modules', 'depends': [ - 'ir_attachment_metadata', + 'attachment_metadata', ], 'external_dependencies': { 'python': [ diff --git a/external_file_location/abstract_task.py b/external_file_location/abstract_task.py index f8fe3237..bfb8d8f9 100644 --- a/external_file_location/abstract_task.py +++ b/external_file_location/abstract_task.py @@ -10,6 +10,9 @@ class AbstractTask(object): _key = None _synchronize_type = None _default_port = None + _hide_login = False + _hide_password = False + _hide_port = False def create_file(self, filename, data): ir_attachment_id = self.env['ir.attachment.metadata'].create({ diff --git a/external_file_location/attachment_view.xml b/external_file_location/attachment_view.xml index de7c65f9..b17e8ad7 100644 --- a/external_file_location/attachment_view.xml +++ b/external_file_location/attachment_view.xml @@ -4,7 +4,7 @@ ir.attachment.metadata - + diff --git a/external_file_location/location.py b/external_file_location/location.py index 99eebb39..91d4ad2f 100644 --- a/external_file_location/location.py +++ b/external_file_location/location.py @@ -32,10 +32,13 @@ class Location(models.Model): name = fields.Char(string='Name', required=True) protocol = fields.Selection(selection='_get_protocol', required=True) address = fields.Char(string='Address', required=True) - port = fields.Integer(required=True) - login = fields.Char(required=True) + port = fields.Integer() + login = fields.Char() password = fields.Char() task_ids = fields.One2many('external.file.task', 'location_id') + hide_login = fields.Boolean() + hide_password = fields.Boolean() + hide_port = fields.Boolean() def _get_protocol(self): res = [] @@ -48,7 +51,19 @@ class Location(models.Model): return res @api.onchange('protocol') - def get_default_port(self): + def onchange_protocol(self): for cls in itersubclasses(AbstractTask): if cls._key == self.protocol: self.port = cls._default_port + if cls._hide_login: + self.hide_login = True + else: + self.hide_login = False + if cls._hide_password: + self.hide_password = True + else: + self.hide_password = False + if cls._hide_port: + self.hide_port = True + else: + self.hide_port = False diff --git a/external_file_location/location_view.xml b/external_file_location/location_view.xml index 827baa7b..5d2ee0a9 100644 --- a/external_file_location/location_view.xml +++ b/external_file_location/location_view.xml @@ -16,9 +16,9 @@ - - - + + + @@ -30,6 +30,9 @@