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

        issue11434
        review405301002
        (grafted from 00a9ee03419ae49076d1942881b2ffd93b5d6e27)
diffstat:

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

diffs (16 lines):

diff -r 0ba5e22aed21 -r f0a79aae331b account.py
--- a/account.py        Fri Oct 15 17:28:32 2021 +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