Wrong invoice account when changing invoice date
When using a receivable/payable account with an end_date and a replaced_by value set a wrong account is selected when changing the invoice date.
Steps to reproduce:
1. Set an end_date (in the past) for the payable account of the party.
2. Create a new account for the payable and set start_date the next_day of the previous end_date
3. Set the new account as replaced_by of previous payable account.
4. Create a supplier invoice a using a party with the payable account with end date.
5. Set the invoice_date before the end_date of the account.
Current behaviour:
* The new payable account is selected as invoice account
Expected behaviour:
* The original payable account is selected as invoice account.