changeset b6ce941ef786 in modules/sale_shipment_grouping:default
details:
https://hg.tryton.org/modules/sale_shipment_grouping?cmd=changeset&node=b6ce941ef786
description:
Process shipments one by one when grouping
issue11685
review435841003
diffstat:
sale.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r 0e8248ae9453 -r b6ce941ef786 sale.py
--- a/sale.py Sun Oct 16 14:14:12 2022 +0200
+++ b/sale.py Fri Oct 28 00:31:07 2022 +0200
@@ -1,6 +1,8 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+from itertools import groupby
+
from trytond.pool import PoolMeta
from trytond.transaction import Transaction
@@ -57,3 +59,13 @@
if grouped_shipments:
shipment, = grouped_shipments
return shipment
+
+ @classmethod
+ def _process_shipment(cls, sales):
+ for method, sales in groupby(
+ sales, lambda s: s.shipment_grouping_method):
+ if method:
+ for sale in sales:
+ super()._process_shipment([sale])
+ else:
+ super()._process_shipment(list(sales))