From 165ecd487ad717007a6ef7777b904f3b60e0aed3 Mon Sep 17 00:00:00 2001 From: Bernat Date: Thu, 21 Oct 2021 00:06:08 +0200 Subject: [PATCH] Do not reverse commission when canceling invoice with move issue10845 review387121002 (grafted from 8edc569fdc8713d2726b0d88970df1f6d6b45f75) --HG-- branch : 6.0 --- invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invoice.py b/invoice.py index 53dcbe3bc8..088e44dc9c 100644 --- a/invoice.py +++ b/invoice.py @@ -86,11 +86,13 @@ class Invoice(metaclass=PoolMeta): pool = Pool() Commission = pool.get('commission') + invoices_to_revert_commission = [x for x in invoices if not x.move] + super(Invoice, cls).cancel(invoices) to_delete = [] to_save = [] - for sub_invoices in grouped_slice(invoices): + for sub_invoices in grouped_slice(invoices_to_revert_commission): ids = [i.id for i in sub_invoices] to_delete += Commission.search([ ('invoice_line', '=', None),