Browse Source

[FIX] bug of file import related to api.multi

pull/515/head
Mourad El Hadj Mimoune 9 years ago
committed by Florian da Costa
parent
commit
785691d6ca
  1. 9
      attachment_metadata/models/attachment.py

9
attachment_metadata/models/attachment.py

@ -33,9 +33,12 @@ class IrAttachmentMetadata(models.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:
for attachment in self:
if attachment.datas:
attachment.internal_hash = hashlib.md5(
b64decode(self.datas)).hexdigest()
if attachment.external_hash and\
attachment.internal_hash != attachment.external_hash:
raise UserError(
_("File corrupted: Something was wrong with "
"the retrieved file, please relaunch the task."))

Loading…
Cancel
Save