The error occurs when system tries to create a sales invoice for second ship group of the sales order and is due to "divide by zero" which in not permitted.
This is due to several changes in opentaps 1.5 for new ship group creation (release as well as git version).
This issue can be replicated in official opentaps demo.
Steps to replicate -
1. Create an order with two products.
2. Split products across 2 ship groups.
3. When you've created the ship group and added products to it, system tries to re-arrange the sales taxes uniformly across the new & existing ship groups, the root cause lies in the re-arrangement & distribution of sales tax.
4. To compensate for the incorrect re-arrangement, system creates an additional negative adjustment over the entire order. So if one fixes the "divide by zero" issue, it is very easy to notice the incorrect sales tax & negative adjustment values in the invoice which leads to confusion.
5. Moreover if new ship group's destination address to a different state, system correctly calculates the new tax, but does not display it on the invoice.