changeset 00a9ee03419a in modules/account_fr_chorus:default
details: 
https://hg.tryton.org/modules/account_fr_chorus?cmd=changeset&node=00a9ee03419a
description:
        Create invoice to send only for newly posted invoices

        issue11434
        review405301002
diffstat:

 account.py |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r e73f43aa1dcf -r 00a9ee03419a account.py
--- a/account.py        Sat Apr 16 18:30:16 2022 +0200
+++ b/account.py        Fri Apr 29 23:42:52 2022 +0200
@@ -109,9 +109,11 @@
     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)

Reply via email to