Taxes for sale advance payment

The sale_advance_payment modules does take into account the different taxes in each line on the sale.
I think that this can be also considered as bug behavior, but I will not go against considering only a feature.
For example:
Considering an advance condition of 50% and 50% of untaxed_amount. (not relevant).
Creating a sale with this advance payment conditions, for:

2 units of product A (10€). With Tax 10%.
2 units of product B (10€). With Tax 20%.
untaxed = 40€
taxes = 6€
total = 46€

Once the advance invoices are generated when the sale is confirmed, each invoice is 20€ + the default taxes of the advance account (20%).

So now we have two invoices:

total invoice 1 = 20 + 20% (account tax) = 24€
total invoice 2 = 20 + 20% (account tax) = 24€

So now the total of the sale (which the customer accepted) does not match with the total for the invoices.

One possible approach is to instead of generating one line for each condition. Generate the same lines we have on the sales but changing the unit_price of each line according to the condition ratio. This way we can copy the sale lines (quantity, taxes…) to the invoice lines only changing the unit price and setting the origin to the condition.
And the actual line that is generated with the amount of the condition, It might be generated as a title line with the description.

I see no problem here just bad configuration because at the end the final invoice will have the right amount.

Which is the bad configuration?

  • advance payment with taxes
  • advance payment for 100%