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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user