details: https://code.tryton.org/tryton/commit/78bf3c890afc
branch: 7.0
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
(grafted from 7b9bcbe10ded642353834ba189a888119d7073ae)
diffstat:
modules/product_kit/common.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 3382150c0b47 -r 78bf3c890afc modules/product_kit/common.py
--- a/modules/product_kit/common.py Thu Sep 10 14:14:16 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