[IMP] ignore attachments for unknown models because core chokes on that

This commit is contained in:
Holger Brunn 2015-01-26 13:07:35 +01:00
parent 1c0dfff8f3
commit 3572d0d2f4

View File

@ -92,7 +92,14 @@ class IrAttachment(Model):
# attachments can be big, so we read every attachment on its own # attachments can be big, so we read every attachment on its own
for attachment_id in attachment_ids: for attachment_id in attachment_ids:
attachment_data = ir_attachment.read( attachment_data = ir_attachment.read(
cr, uid, [attachment_id], ['datas'], context=context)[0] cr, uid, [attachment_id], ['datas', 'res_model'],
context=context)[0]
if attachment_data['res_model'] and not self.pool.get(
attachment_data['res_model']):
logging.warning(
'not moving attachment %d because it links to unknown '
'model %s', attachment_id, attachment_data['res_model'])
continue
ir_attachment.write( ir_attachment.write(
cr, uid, [attachment_id], cr, uid, [attachment_id],
{ {