From a241eb3f96d6e286c1ec95c57ccac92d31fbb1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 6 Jan 2024 01:32:52 +0100 Subject: [PATCH] Group only customer shipment by cost method The return shipment does not have this field. Closes #12842 --- modules/sale_shipment_cost/sale.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/sale_shipment_cost/sale.py b/modules/sale_shipment_cost/sale.py index 6d6226f375..6d61d270d4 100644 --- a/modules/sale_shipment_cost/sale.py +++ b/modules/sale_shipment_cost/sale.py @@ -368,8 +368,13 @@ class Sale(metaclass=PoolMeta): return cost_line def _get_shipment_grouping_fields(self, shipment): - return super()._get_shipment_grouping_fields(shipment) + [ - 'cost_method', 'carrier'] + pool = Pool() + ShipmentOut = pool.get('stock.shipment.out') + fields = super()._get_shipment_grouping_fields(shipment) + fields.append('carrier') + if isinstance(shipment, ShipmentOut): + fields.append('cost_method') + return fields @property def shipment_cost_amount(self):