Set invoice line state to paid when invoice is cancelled with cancel move

Such invoice line should be considered as booked for example to compute the
invoiced quantity of stock move.

Closes #13085
This commit is contained in:
Cédric Krier
2024-03-08 12:29:03 +01:00
parent d85d7a1f9c
commit 40d4fe61ac
+6 -2
View File
@@ -2428,8 +2428,12 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin):
@fields.depends('invoice', '_parent_invoice.state')
def on_change_with_invoice_state(self, name=None):
if self.invoice:
return self.invoice.state
return 'draft'
state = self.invoice.state
if state == 'cancelled' and self.invoice.cancel_move:
state = 'paid'
else:
state = 'draft'
return state
@fields.depends('invoice', '_parent_invoice.party', 'party')
def on_change_with_party_lang(self, name=None):