Set invoice pending amount as line amount when creating lines from origins
It is very common to have a single statement origin that is related to multiple invoices. Some examples are:
- You receive a payment from the same customer that it's related to multiple invoices.
- You receive the payment of a SEPA payment group which is related to multiple customer invoices.
In this case you have to split the same statement origin into multiple statement lines (one for each invoice), this works well but the behavior is a little bit weird:
- When selecting the invoice the line amount is not updated to match the pending invoice amount, so you have to update the line amount to match the invoice amount. Furthermore, when updating the amount the invoice field is cleared and it has to be selected another time.
I think it can be improve as follow:
- When selecting an invoice, if the invoice amount to pay is less than the line amount it's updated to match the pending amount.
This improves the statement encoding speed as the user only has to find all the invoices that are related to this statement origin an check that all amounts match.