diff --git a/attachment_metadata/models/attachment.py b/attachment_metadata/models/attachment.py index d27a43292..813255710 100644 --- a/attachment_metadata/models/attachment.py +++ b/attachment_metadata/models/attachment.py @@ -25,6 +25,11 @@ class IrAttachmentMetadata(models.Model): attachment_id = fields.Many2one( 'ir.attachment', required=True, ondelete='cascade', help="Link to ir.attachment model ") + file_type = fields.Selection( + selection="_get_file_type", + string="File type", + help="The file type detrmine an import method to be used " + "to parse and transforme data before theire import in odoo") @api.depends('datas', 'external_hash') def _compute_hash(self): @@ -34,3 +39,10 @@ class IrAttachmentMetadata(models.Model): raise UserError( _("File corrupted: Something was wrong with " "the retrieved file, please relaunch the task.")) + + def _get_file_type(self): + """This is the method to be inherited for adding file types + The basic import do not apply any parsing or transform of the file. + The file is just added as an attachement + """ + return [('basic_import', 'Basic import')] diff --git a/attachment_metadata/views/attachment_view.xml b/attachment_metadata/views/attachment_view.xml index 11e70172b..b3a8dd06f 100644 --- a/attachment_metadata/views/attachment_view.xml +++ b/attachment_metadata/views/attachment_view.xml @@ -9,6 +9,7 @@ +