changeset 701058e8efd0 in modules/sale_shipment_grouping:6.4
details:
https://hg.tryton.org/modules/sale_shipment_grouping?cmd=changeset&node=701058e8efd0
description:
Process shipments one by one when grouping
issue11685
review435841003
(grafted from b6ce941ef786ec9c8519ce9d3c64b32173cba0e3)
diffstat:
sale.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r 23729fe275c6 -r 701058e8efd0 sale.py
--- a/sale.py Mon May 02 17:31:08 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))