Always return float for invoice or moves progress
The fields are Float so they must return a float.
This commit is contained in:
1 parent
07d0a29bdc
commit
3a25fc0df9
3 files changed
+6
-6
No files matched your search
@@ -229,7 +229,7 @@ def order_line_mixin(prefix):
|
||||
def get_moves_progress(self, name):
|
||||
progress = super().get_moves_progress(name)
|
||||
if self.components:
|
||||
progress = 0
|
||||
progress = 0.
|
||||
for component in self.components:
|
||||
progress += component.moves_progress
|
||||
progress = round(progress / len(self.components), 4)
|
||||
@@ -354,7 +354,7 @@ def order_line_component_mixin(prefix):
|
||||
if quantity is not None and self.quantity:
|
||||
progress = round(
|
||||
(abs(self.quantity) - quantity) / abs(self.quantity), 4)
|
||||
progress = max(0, min(1, progress))
|
||||
progress = max(0., min(1., progress))
|
||||
return progress
|
||||
|
||||
def get_moved_ratio(self):
|
||||
|
||||
@@ -1400,7 +1400,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
|
||||
quantity = self._invoice_remaining_quantity
|
||||
if quantity is not None and self.quantity:
|
||||
progress = round((self.quantity - quantity) / self.quantity, 4)
|
||||
progress = max(0, min(1, progress))
|
||||
progress = max(0., min(1., progress))
|
||||
return progress
|
||||
|
||||
@property
|
||||
@@ -1432,7 +1432,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
|
||||
if quantity is not None and self.quantity:
|
||||
progress = round(
|
||||
(abs(self.quantity) - quantity) / abs(self.quantity), 4)
|
||||
progress = max(0, min(1, progress))
|
||||
progress = max(0., min(1., progress))
|
||||
return progress
|
||||
|
||||
def _get_tax_rule_pattern(self):
|
||||
|
||||
@@ -1478,7 +1478,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
|
||||
quantity = self._invoice_remaining_quantity
|
||||
if quantity is not None and self.quantity:
|
||||
progress = round((self.quantity - quantity) / self.quantity, 4)
|
||||
progress = max(0, min(1, progress))
|
||||
progress = max(0., min(1., progress))
|
||||
return progress
|
||||
|
||||
@property
|
||||
@@ -1519,7 +1519,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
|
||||
if quantity is not None and self.quantity:
|
||||
progress = round(
|
||||
(abs(self.quantity) - quantity) / abs(self.quantity), 4)
|
||||
progress = max(0, min(1, progress))
|
||||
progress = max(0., min(1., progress))
|
||||
return progress
|
||||
|
||||
@property
|
||||
|
||||
Reference in new issue
Block a user