Dolibarr defaults round taxes on each product and adds taxes. In Quebec (Canada), it is necessary that the sum of the products is done and that the computation of the taxes is then made.
So, I set constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND to 1.
Even in canada it becomes very rare now to have the rounding done on the final sum. Reason is that rounding in final sum generate not accurate accounting.
What is expected is to have a sale tax that is defined per rate, and in both method, you will get it.
Are you sure you really need this ? (The MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is not documented because rounding at final computation was used a long time ago when invoice were done using calc / sheet. Since invoicing is done with specialized software, rounding per line is more used, above all by large companies).
But it seem that when the constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is set, that work well for the first tax (TPS/TVH) but not to the second tax (TVQ).