From 9ba7970f41f35b5e35c11710ad910798f03f0d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 7 Apr 2025 00:23:44 +0200 Subject: [PATCH] Check invoice state only for modified lines with an invoice Since 6c72b78d92d8 the rewrite of the check did not skip invoice line without invoice. --- modules/account_invoice/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account_invoice/invoice.py b/modules/account_invoice/invoice.py index c882f148f7..c68ebc7638 100644 --- a/modules/account_invoice/invoice.py +++ b/modules/account_invoice/invoice.py @@ -2793,7 +2793,7 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): mode, lines, values=values, external=external) if mode == 'create': for line in lines: - if line.invoice.state != 'draft': + if line.invoice and line.invoice.state != 'draft': raise AccessError(gettext( 'account_invoice.msg_invoice_line_create_draft', invoice=line.invoice.rec_name))