diff --git a/attachment_metadata/README.rst b/attachment_metadata/README.rst index f9640f29e..926d24474 100644 --- a/attachment_metadata/README.rst +++ b/attachment_metadata/README.rst @@ -1,51 +1,77 @@ + .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +==================== Attachment Metadata -====================== - -This module was written to extend the functionality of ir.attachment +==================== -Installation -============ +This module extend ir.attachment model with some new fields for a better control +for import and export of files. The main feature is an integrity file check with a hash. -Installable without any requirements Usage ===== -THe module just add some field to ir.attachment +Go the menu Settings > Attachments + +You can create / see standard attachments with additional fields + -For further information, please visit: -* https://www.odoo.com/forum/help-1 +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/{repo_id}/8.0 + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example Known issues / Roadmap ====================== +* ... + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed `feedback +`_. + Credits ======= -* Joel Grand-Guillaume Camptocamp -* initOS -* Valentin CHEMIERE +Images +------ + +* Odoo Community Association: `Icon `_. + Contributors ------------ +* Valentin CHEMIERE * Sebastien BEAU +* Joel Grand-Guillaume Camptocamp +* initOS Maintainer ---------- -* Valentin CHEMIERE - -.. image:: http://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: http://odoo-community.org +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org This module is maintained by the OCA. -OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/attachment_metadata/attachment.py b/attachment_metadata/attachment.py index 85f3da4e9..d27a43292 100644 --- a/attachment_metadata/attachment.py +++ b/attachment_metadata/attachment.py @@ -14,16 +14,23 @@ class IrAttachmentMetadata(models.Model): _name = 'ir.attachment.metadata' _inherits = {'ir.attachment': 'attachment_id'} - internal_hash = fields.Char(store=True, compute='_compute_hash') - external_hash = fields.Char() - attachment_id = fields.Many2one('ir.attachment', required=True, - ondelete='cascade') + internal_hash = fields.Char( + store=True, compute='_compute_hash', + help="File hash computed with file data to be compared " + "to external hash when provided.") + external_hash = fields.Char( + help="File hash comes from the external owner of the file.\n" + "If provided allow to check than downloaded file " + "is the exact copy of the original file.") + attachment_id = fields.Many2one( + 'ir.attachment', required=True, ondelete='cascade', + help="Link to ir.attachment model ") @api.depends('datas', 'external_hash') def _compute_hash(self): if self.datas: self.internal_hash = hashlib.md5(b64decode(self.datas)).hexdigest() if self.external_hash and self.internal_hash != self.external_hash: - raise UserError(_('File corrupted'), - _("Something was wrong with the retreived file, " - "please relaunch the task.")) + raise UserError( + _("File corrupted: Something was wrong with " + "the retrieved file, please relaunch the task.")) diff --git a/attachment_metadata/attachment_view.xml b/attachment_metadata/attachment_view.xml index a95535596..11e70172b 100644 --- a/attachment_metadata/attachment_view.xml +++ b/attachment_metadata/attachment_view.xml @@ -1,17 +1,17 @@ - + - - ir.attachment.metadata - - - - - - - - + + ir.attachment.metadata + + + + + + + + - +