changeset f80f56604a5d in modules/sale_shipment_cost:default
details: 
https://hg.tryton.org/modules/sale_shipment_cost?cmd=changeset&node=f80f56604a5d
description:
        Set carrier when instantiate shipment to allow grouping

        issue10805
        review379171003
diffstat:

 sale.py |  10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diffs (29 lines):

diff -r 0b3626d50ad8 -r f80f56604a5d sale.py
--- a/sale.py   Fri Oct 08 19:58:17 2021 +0200
+++ b/sale.py   Sat Oct 09 01:05:17 2021 +0200
@@ -282,7 +282,7 @@
 
     @property
     def _shipment_grouping_fields(self):
-        return super()._shipment_grouping_fields + ('cost_method',)
+        return super()._shipment_grouping_fields + ('cost_method', 'carrier')
 
     @property
     def shipment_cost_amount(self):
@@ -298,15 +298,9 @@
         shipment = super()._get_shipment_sale(Shipment, key)
         if isinstance(shipment, ShipmentOut):
             shipment.cost_method = self.shipment_cost_method
+            shipment.carrier = self.carrier
         return shipment
 
-    def create_shipment(self, shipment_type):
-        shipments = super().create_shipment(shipment_type)
-        if shipment_type == 'out' and shipments and self.carrier:
-            for shipment in shipments:
-                shipment.carrier = self.carrier
-        return shipments
-
     def create_invoice(self):
         pool = Pool()
         InvoiceLine = pool.get('account.invoice.line')

Reply via email to