Delete draft invoice

Delete method forces cancel and prevents physical deletion of invoices

i’m running into an issue when trying to delete invoices the situation is

i have an invoice in draft state.

i call => AccountInvoice.delete([invoice])

the delete() method calls cancel() and sets the invoice state to ‘cancel’:

cls.write(invoices, {‘state’: ‘cancel’})

After that, Tryton raises a UserError:

you cannot modify the invoice because it is posted, paid, or canceled

Which version are you using? Because we write cancelled and test against cancelled.