diff --git a/invoice.py b/invoice.py index b0253c3580..767f77869e 100644 --- a/invoice.py +++ b/invoice.py @@ -1334,10 +1334,10 @@ class Invoice(Workflow, ModelSQL, ModelView): for invoice in invoices: invoice.set_number() moves.append(invoice.create_move()) - cls.write(invoices, { + cls.write([i for i in invoices if i.state != 'posted'], { 'state': 'posted', }) - Move.post(moves) + Move.post([m for m in moves if m.state != 'posted']) for invoice in invoices: if invoice.type in ('out_invoice', 'out_credit_note'): invoice.print_invoice()