Your business precedure here (IMO) is wrong. You should not be selling the item at zero cost, in fact you should be delivering the item late to the client, since they have already purchased it when they purchased the completed product.
The ideal solution would be to include the item as a component of the production fo rcost purposes, but to have it seperate for delivery purposes. And since this is not standard, you need to figure out a work around. Firstly what is the reason for using a Sales Invoice, is it to generate shipping documents?
If this does not happen too often, then I would look at just doing th eprocess manually, and keeping the poruction as it is. If this is a part of the business procedure, then there are a number of options that you cna look into. But I would definitely avoid any code here, because a project like this will bloat and inflate.
One possibility is this. It assumes that you know in advance who the client is, and you knwo which component will not be delivered with the initial Product.
- Generate a Sales order to the Client.
- Add the missing item to the invoice with NEGATIVE quantity.
- For this line create a new Location such as Z-MFGADJ
- Ship the Order.
- Manufacture the Final product INCLUDING the non shipped component, and source this from location Z-MFGADJ
- Either use the exisitng order or create a new one and ship and sell the manufactured item to the client.
- When the Component arrives, receive it into the Z-MFGADJ location
- Go back to the first order, and add a new POSITIVE line to the order.
- Set the Unit Pirce on both lines as zero, and Ship and Invoice the remainder of the order.
Now this all looks very complex, and I am pretty certain you/your client will not accpeptthis process, but what it does is gives you a starting point. THe accoutning will be correct, and then its just a case of making it work.