From 1f486da4cd157694932e373b7f7fbdd488ca1c5c Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Sun, 2 Apr 2017 12:30:18 +0200 Subject: [PATCH] [FIX] ignore exceptions when moving attachment --- .../models/ir_attachment.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/attachments_to_filesystem/models/ir_attachment.py b/attachments_to_filesystem/models/ir_attachment.py index b5603d05..74148f52 100644 --- a/attachments_to_filesystem/models/ir_attachment.py +++ b/attachments_to_filesystem/models/ir_attachment.py @@ -102,12 +102,15 @@ class IrAttachment(Model): 'not moving attachment %d because it links to unknown ' 'model %s', attachment_id, attachment_data['res_model']) continue - ir_attachment.write( - cr, uid, [attachment_id], - { - 'datas': attachment_data['datas'], - 'db_datas': False, - }, - context=context) + try: + ir_attachment.write( + cr, uid, [attachment_id], + { + 'datas': attachment_data['datas'], + 'db_datas': False, + }, + context=context) + except Exception: + logging.exception('Error moving attachment #%d', attachment_id) if not counter % (len(attachment_ids) / 100 or limit): logging.info('moving attachments: %d done', counter)