diff --git a/muk_utils/__manifest__.py b/muk_utils/__manifest__.py index 20d019a..1f3b451 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.5', + "version": '12.0.2.0.6', "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 1d1a2df..931f7b4 100644 --- a/muk_utils/models/ir_attachment.py +++ b/muk_utils/models/ir_attachment.py @@ -107,9 +107,13 @@ class IrAttachment(models.Model): storage_location = self._storage().upper() batches = math.ceil(len(self) / batch_size) for index, attachment in enumerate(self, start=1): + current_batch = math.ceil(index / batch_size) + counter = len(self) - (batches - 1) * batch_size + counter = counter if current_batch == batches else batch_size _logger.info("Migrate Attachment %s of %s to %s [Batch %s of %s]", - index % batch_size or batch_size, batch_size, storage_location, - math.ceil(index / batch_size), batches + index % batch_size or batch_size, counter, + storage_location, current_batch, batches + ) attachment.with_context(migration=True).write({ 'datas': attachment.datas