Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
502c9dcd by Cédric Krier at 2023-02-09T11:12:20+01:00
Replace shipment_type by Shipment in sale grouping method

Since the introduction in 344956d44189 of the _get_shipment_sale method, it is
the shipment class that is passed as argument and never the shipment type..
- - - - -


1 changed file:

- modules/sale_shipment_grouping/sale.py


Changes:

=====================================
modules/sale_shipment_grouping/sale.py
=====================================
@@ -29,7 +29,7 @@
     def _get_grouped_shipment_planned_date(self, shipment):
         return [('planned_date', '=', shipment.planned_date)]
 
-    def _get_grouped_shipment_order(self, shipment_type):
+    def _get_grouped_shipment_order(self, Shipment):
         "Returns the order used to find shipments that should be grouped"
         return None
 
@@ -48,6 +48,6 @@
                     getattr(shipment, field, defaults.get(field))))
         return shipment_domain
 
-    def _get_shipment_sale(self, shipment_type, values):
+    def _get_shipment_sale(self, Shipment, values):
         transaction = Transaction()
         context = transaction.context
@@ -52,6 +52,6 @@
         transaction = Transaction()
         context = transaction.context
-        shipment = super(Sale, self)._get_shipment_sale(shipment_type, values)
+        shipment = super(Sale, self)._get_shipment_sale(Shipment, values)
         if (not context.get('skip_grouping', False)
                 and self.shipment_grouping_method):
             with transaction.set_context(skip_grouping=True):
@@ -55,6 +55,5 @@
         if (not context.get('skip_grouping', False)
                 and self.shipment_grouping_method):
             with transaction.set_context(skip_grouping=True):
-                shipment = self._get_shipment_sale(shipment_type, values)
-            Shipment = shipment.__class__
+                shipment = self._get_shipment_sale(Shipment, values)
             domain = self._get_grouped_shipment_domain(shipment)
@@ -60,5 +59,5 @@
             domain = self._get_grouped_shipment_domain(shipment)
-            order = self._get_grouped_shipment_order(shipment_type)
+            order = self._get_grouped_shipment_order(Shipment)
             grouped_shipments = Shipment.search(domain, order=order, limit=1)
             if grouped_shipments:
                 shipment, = grouped_shipments



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/502c9dcd8d035afce18d9829fd968413e1a385ab

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/502c9dcd8d035afce18d9829fd968413e1a385ab
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to