diff --git a/modules/product_kit/common.py b/modules/product_kit/common.py index bb3cb0d3068628ffefddcb2ddab5218a12d230fb_bW9kdWxlcy9wcm9kdWN0X2tpdC9jb21tb24ucHk=..1c1813b5c537d864b73f083d53ded6377e8a1034_bW9kdWxlcy9wcm9kdWN0X2tpdC9jb21tb24ucHk= 100644 --- a/modules/product_kit/common.py +++ b/modules/product_kit/common.py @@ -229,7 +229,7 @@ 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 @@ 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): diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index bb3cb0d3068628ffefddcb2ddab5218a12d230fb_bW9kdWxlcy9wdXJjaGFzZS9wdXJjaGFzZS5weQ==..1c1813b5c537d864b73f083d53ded6377e8a1034_bW9kdWxlcy9wdXJjaGFzZS9wdXJjaGFzZS5weQ== 100644 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1400,7 +1400,7 @@ 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 @@ 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): diff --git a/modules/sale/sale.py b/modules/sale/sale.py index bb3cb0d3068628ffefddcb2ddab5218a12d230fb_bW9kdWxlcy9zYWxlL3NhbGUucHk=..1c1813b5c537d864b73f083d53ded6377e8a1034_bW9kdWxlcy9zYWxlL3NhbGUucHk= 100644 --- a/modules/sale/sale.py +++ b/modules/sale/sale.py @@ -1478,7 +1478,7 @@ 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 @@ 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 diff --git a/modules/sale_shipment_cost/sale.py b/modules/sale_shipment_cost/sale.py index bb3cb0d3068628ffefddcb2ddab5218a12d230fb_bW9kdWxlcy9zYWxlX3NoaXBtZW50X2Nvc3Qvc2FsZS5weQ==..1c1813b5c537d864b73f083d53ded6377e8a1034_bW9kdWxlcy9zYWxlX3NoaXBtZW50X2Nvc3Qvc2FsZS5weQ== 100644 --- a/modules/sale_shipment_cost/sale.py +++ b/modules/sale_shipment_cost/sale.py @@ -436,6 +436,13 @@ shipment_cost_invoiced.append(shipment.id) return lines + @property + def _invoice_remaining_quantity(self): + quantity = super()._invoice_remaining_quantity + if self.shipment_cost is not None: + quantity = 0 + return quantity + def _get_invoice_line_quantity(self): quantity = super()._get_invoice_line_quantity() if self.shipment_cost is not None: diff --git a/modules/sale_shipment_cost/tests/scenario_sale_shipment_cost.rst b/modules/sale_shipment_cost/tests/scenario_sale_shipment_cost.rst index bb3cb0d3068628ffefddcb2ddab5218a12d230fb_bW9kdWxlcy9zYWxlX3NoaXBtZW50X2Nvc3QvdGVzdHMvc2NlbmFyaW9fc2FsZV9zaGlwbWVudF9jb3N0LnJzdA==..1c1813b5c537d864b73f083d53ded6377e8a1034_bW9kdWxlcy9zYWxlX3NoaXBtZW50X2Nvc3QvdGVzdHMvc2NlbmFyaW9fc2FsZV9zaGlwbWVudF9jb3N0LnJzdA== 100644 --- a/modules/sale_shipment_cost/tests/scenario_sale_shipment_cost.rst +++ b/modules/sale_shipment_cost/tests/scenario_sale_shipment_cost.rst @@ -127,6 +127,8 @@ 1.0 >>> cost_line.amount Decimal('3.00') + >>> cost_line.invoice_progress + 1.0 >>> sale.click('confirm') >>> sale.click('process') >>> sale.state @@ -211,6 +213,8 @@ 1.0 >>> cost_line.amount Decimal('3.00') + >>> cost_line.invoice_progress + 1.0 >>> sale.click('confirm') >>> sale.click('process') >>> sale.state