Hi Sam,
my solution would be to create a custom cancel button where I rollback the Invoice and InvoiceLines, and delete the InvoiceLines where the function isNew($InvoiceLine) is true. You can do this in a loop where you check for this condition, or if you're in Mx9 you can use the new feature 'Filter by Expression’ in the List Operation activity.
Looks like, when a new invoice line is created, you are committing the object.
When deleting, you are deleting the invoice line object directly.
For new items:
- Create a new invoice line object and associate it with invoice object but dont commit it
- Do the commit, when you are saving the invoice → retrieve all invoice lines and commit it with commit action
- note: IsNew works only with objects that are not committed yet
For Delete items:
- only remove the association between objects but dont commit it yet
- When you save the invoice, retrieve all the associated invoice lines and commit
- Retrieve all the invoice lines without associated invoice lines and delete it
With this, your normal cancel should be working fine.