From ba31233fb0a8013fb092bb01fed28cf570d466fa Mon Sep 17 00:00:00 2001 From: ralwafaie Date: Thu, 17 Nov 2016 14:48:01 +0100 Subject: [PATCH] catch case if no binary is given --- 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(