From c70f558427d3fd9519cf8383e1f4e1dc4577b420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 22 Aug 2025 11:13:57 +0200 Subject: [PATCH] Do not sum moves progress of component if it is None When the component has no move, its moves progress is None so it can not be added to the general progress. Closes #14183 (grafted from a5b9250ef647bb963b912709db2c87556d9ac101) --HG-- branch : 7.0 --- modules/product_kit/common.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/product_kit/common.py b/modules/product_kit/common.py index 8ca4476ff9..72f8094365 100644 --- a/modules/product_kit/common.py +++ b/modules/product_kit/common.py @@ -229,10 +229,16 @@ def order_line_mixin(prefix): def get_moves_progress(self, name): progress = super().get_moves_progress(name) if self.components: - progress = 0. - for component in self.components: - progress += component.moves_progress - progress = round(progress / len(self.components), 4) + if any(c.moves_progress is not None for c in self.components): + progress = 0. + n = 0 + for component in self.components: + if component.moves_progress is not None: + progress += component.moves_progress + n += 1 + progress = round(progress / n, 4) + else: + progress = None return progress def _get_invoice_line_quantity(self):