1. I would create each invoice item and leave the invoice field empty in the beginning, they will still be saved to the database, and
  2. add them a to a list custom state to save some work finding them later.
  3. when user clicks the button to create invoice, create a new thing (invoice) and then make changes to list of things (the custom state’s list) where invoice = result of step 1 (create invoice).