From b0d38bd797a6027d53d32e55a4abbe08bdcf6f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 4 Apr 2024 15:13:36 +0200 Subject: [PATCH] Set invoice progress of shipment cost line of sale always as 100% Closes #13160 --- modules/sale_shipment_cost/sale.py | 7 +++++++ .../tests/scenario_sale_shipment_cost.rst | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/modules/sale_shipment_cost/sale.py b/modules/sale_shipment_cost/sale.py index 51eacb4e97..ab0c5c38b2 100644 --- a/modules/sale_shipment_cost/sale.py +++ b/modules/sale_shipment_cost/sale.py @@ -436,6 +436,13 @@ class Line(metaclass=PoolMeta): 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 83e6876e2e..f85d6f1a4f 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 @@ Sale products with cost on shipment:: 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 @@ Sale products with cost on order:: 1.0 >>> cost_line.amount Decimal('3.00') + >>> cost_line.invoice_progress + 1.0 >>> sale.click('confirm') >>> sale.click('process') >>> sale.state