The problem is that the discount simply applies to the total amount regardless the taxes in the case of an order discount (I don’t now for products or categories).
If we have on order with 120€ including 20% taxes, this means 100€ plus 20€ taxes.
If we apply a discount of 100€, then the order amount will be 20€, but the taxes are still 20€. We will have to pay this 20€ taxes while we did not get any money.
A correct calculation would be 120€ – (100€ discount + 100€*20% taxes) = 0€
A right approach would be to configure the the taxe rate applicable to a given discount :
- at the simplest : fixed taxe rate selected among configured taxe rates
- More sophisticated, in addition to the above : based on the more expensive item, on the highest or lowest taxe rate….