issue12567.diff [account_invoice_defer] Defer invoice line only once

#162243
This commit is contained in:
Raimon Esteve 2023-10-25 16:48:14 +02:00
parent 0299411913
commit 3d9b2030f7
2 changed files with 19 additions and 0 deletions

17
issue12567.diff Normal file
View File

@ -0,0 +1,17 @@
diff --git a/tryton/modules/account_invoice_defer/account.py b/tryton/modules/account_invoice_defer/account.py
index 22e28da6c9..be4d4d06f5 100644
--- a/tryton/modules/account_invoice_defer/account.py
+++ b/tryton/modules/account_invoice_defer/account.py
@@ -460,9 +460,11 @@ class Invoice(metaclass=PoolMeta):
def _post(cls, invoices):
pool = Pool()
InvoiceDeferred = pool.get('account.invoice.deferred')
+ # defer invoices only the first time post is called
+ invoices_to_defer = [i for i in invoices if not i.move]
super()._post(invoices)
deferrals = []
- for invoice in invoices:
+ for invoice in invoices_to_defer:
for line in invoice.lines:
print(invoice, line, line.defer_from)
if line.deferrable and line.defer_from and line.defer_to:

2
series
View File

@ -121,3 +121,5 @@ issue12570.diff # [account] Do not compute account party for general ledger line
issue12590.diff # [account_payment] Do not test active clause of dunning being in a set
issue12618.diff # [sao] Wrap long label to 80 chars
issue12567.diff # [account_invoice_defer] Defer invoice line only once