Posting an invoice, line items getting added.

Our software imports invoices into Sage 50 Canadian edition via the SDK. For a couple customers, it seems line items are getting added in that we are not creating when the invoice is posted. 

After trolling through the database it seems like these line items are coming from either contracts or delivery orders as the text of the line items only seems to be appearing there.

Is there a setting or something in Sage that will prevent line items from automatically getting added to an invoice or something I need to do in the SDK to make sure this doesn't happen?