Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 6 years ago
parent
commit
807af7f34e
  1. 2
      muk_utils/__manifest__.py
  2. 14
      muk_utils/models/ir_attachment.py

2
muk_utils/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Utils",
"summary": """Utility Features""",
"version": '12.0.1.1.4',
"version": '12.0.1.1.5',
"category": 'Extra Tools',
"license": "AGPL-3",
"author": "MuK IT",

14
muk_utils/models/ir_attachment.py

@ -23,6 +23,7 @@ import mimetypes
from odoo import api, models, _
from odoo.exceptions import AccessError
from odoo.tools.mimetypes import guess_mimetype
_logger = logging.getLogger(__name__)
@ -59,4 +60,15 @@ class Attachment(models.Model):
storage = self._storage().upper()
for index, attach in enumerate(self):
_logger.info(_("Migrate Attachment %s of %s to %s") % (index + 1, record_count, storage))
attach.write({'datas': attach.datas})
attach.with_context(migration=True).write({'datas': attach.datas})
#----------------------------------------------------------
# Read
#----------------------------------------------------------
def _compute_mimetype(self, values):
if self.env.context.get('migration') and len(self) == 1:
return self.mimetype or 'application/octet-stream'
else:
return super(Attachment, self)._compute_mimetype(values)
Loading…
Cancel
Save