details:   https://code.tryton.org/tryton/commit/7b9bcbe10ded
branch:    default
user:      Cédric Krier <[email protected]>
date:      Sun Sep 13 14:01:21 2026 +0200
description:
        Returns unique and ordered shipments when extending sale and purchase 
for kit

        Since 9385c3660f17 the super method returns instances so only instances 
must be
        added to the set to ensure uniqueness.

        Closes #15091
diffstat:

 modules/product_kit/common.py |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 05dbc76d7b37 -r 7b9bcbe10ded modules/product_kit/common.py
--- a/modules/product_kit/common.py     Sun Sep 13 13:57:29 2026 +0200
+++ b/modules/product_kit/common.py     Sun Sep 13 14:01:21 2026 +0200
@@ -4,7 +4,7 @@
 from decimal import Decimal
 from functools import wraps
 
-from trytond.model import ModelStorage, ModelView, Workflow, fields
+from trytond.model import ModelStorage, ModelView, Workflow, fields, sort
 from trytond.pool import Pool
 from trytond.pyson import Eval
 
@@ -15,13 +15,15 @@
         def wrapper(self, name):
             pool = Pool()
             Model = pool.get(model_name)
+            field = getattr(self.__class__, name)
+            order = field.order if field.order is not None else Model._order
             shipments = set(func(self, name))
             for line in self.lines:
                 for component in line.components:
                     for move in component.moves:
                         if isinstance(move.shipment, Model):
-                            shipments.add(move.shipment.id)
-            return list(shipments)
+                            shipments.add(move.shipment)
+            return sort(shipments, order)
         return wrapper
     return _get_shipments_returns
 

Reply via email to