From 4bc573aa4b195cefcd925c8f4fe534c37e9dafa7 Mon Sep 17 00:00:00 2001 From: Hodei Navarro Date: Fri, 29 Apr 2022 23:42:52 +0200 Subject: [PATCH] Create invoice to send only for newly posted invoices issue11434 review405301002 (grafted from 00a9ee03419ae49076d1942881b2ffd93b5d6e27) --HG-- branch : 6.0 --- account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/account.py b/account.py index 315ce5fc89..0347bdb4a8 100644 --- a/account.py +++ b/account.py @@ -109,9 +109,11 @@ class Invoice(metaclass=PoolMeta): def _post(cls, invoices): pool = Pool() InvoiceChorus = pool.get('account.invoice.chorus') + posted_invoices = { + i for i in invoices if i.state in {'draft', 'validated'}} super()._post(invoices) invoices_chorus = [] - for invoice in invoices: + for invoice in posted_invoices: if invoice.type == 'out' and invoice.party.chorus: invoices_chorus.append(InvoiceChorus(invoice=invoice)) InvoiceChorus.save(invoices_chorus)