changeset 70991f1d23ed in modules/sale_invoice_grouping:6.4
details:
https://hg.tryton.org/modules/sale_invoice_grouping?cmd=changeset&node=70991f1d23ed
description:
Process invoices one by one when grouping
issue11685
review435841003
(grafted from b783324efce5b7261cec77f0ce34feea0feeeec2)
diffstat:
sale.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r 37b08fb1ad67 -r 70991f1d23ed sale.py
--- a/sale.py Mon May 02 17:28:57 2022 +0200
+++ b/sale.py Fri Oct 28 00:29:06 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
@@ -51,3 +53,13 @@
if grouped_invoices:
invoice, = grouped_invoices
return invoice
+
+ @classmethod
+ def _process_invoice(cls, sales):
+ for method, sales in groupby(
+ sales, lambda s: s.invoice_grouping_method):
+ if method:
+ for sale in sales:
+ super()._process_invoice([sale])
+ else:
+ super()._process_invoice(list(sales))