From 594f0dd265c2c9b5afb6c16021555e7d44aa3294 Mon Sep 17 00:00:00 2001 From: rami-wafaie Date: Wed, 11 Jan 2017 18:48:00 +0100 Subject: [PATCH] catch case if no binary is given (#112) --- attachment_preview/model/ir_attachment.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/attachment_preview/model/ir_attachment.py b/attachment_preview/model/ir_attachment.py index 98eff341..d7809ffc 100644 --- a/attachment_preview/model/ir_attachment.py +++ b/attachment_preview/model/ir_attachment.py @@ -61,6 +61,9 @@ class IrAttachment(Model): ids_to_browse = [_id for _id in ids_to_browse if _id not in result] for this in self.pool[model].browse(cr, uid, ids_to_browse, context=context): + if this[binary_field] is None: + result[this.id] = False + continue try: import magic ms = magic.open(