18 lines
859 B
Diff
18 lines
859 B
Diff
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:
|