From af053353068d5b6a6a1ea6f1fbf13c93b4dca340 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Fri, 26 Jul 2019 16:52:26 +0000 Subject: [PATCH] publish muk_utils - 12.0 --- muk_utils/__manifest__.py | 2 +- muk_utils/models/ir_attachment.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/muk_utils/__manifest__.py b/muk_utils/__manifest__.py index 8090e52..b93790a 100644 --- a/muk_utils/__manifest__.py +++ b/muk_utils/__manifest__.py @@ -22,7 +22,7 @@ { "name": "MuK Utils", "summary": """Utility Features""", - "version": '12.0.2.0.3', + "version": '12.0.2.0.4', "category": 'Extra Tools', "license": "LGPL-3", "author": "MuK IT", diff --git a/muk_utils/models/ir_attachment.py b/muk_utils/models/ir_attachment.py index 9f7a174..8714485 100644 --- a/muk_utils/models/ir_attachment.py +++ b/muk_utils/models/ir_attachment.py @@ -102,7 +102,8 @@ class IrAttachment(models.Model): @api.multi def migrate(self, batch_size=None): - batch_size = batch_size or batch_size + commit_on_batch = bool(batch_size) + batch_size = batch_size or len(self) storage_location = self._storage().upper() batches = math.ceil(len(self) / batch_size) for index, attachment in enumerate(self, start=1): @@ -113,7 +114,7 @@ class IrAttachment(models.Model): attachment.with_context(migration=True).write({ 'datas': attachment.datas }) - if batch_size and not index % batch_size: + if commit_on_batch and not index % batch_size: self.env.cr.commit() #----------------------------------------------------------