Make deposit work with different currencies
Currently the account_deposit module is not really designed to work with deposits in currencies other than the company currency. This is because the deposit amount stored is in the company currency and if the exchange rate varies the recalled amount will not necessarily match amount paid (see msg21199 on #4744 (closed)).
I think there is a way of fixing this to make deposits work correctly across currencies, however it would be great to get some idea of whether this could work, and whether this is the best way of fixing this issue.
Currently deposits are recalled onto invoices as lines on the invoice. The problem with this is that this looses the information about any second currency amount.
What may fix this is to treat deposits as payments of the invoice, instead of lines on the invoice. The deposit would not be recalled onto the invoice, but would instead be taken at the point of payment (during the PayInvoice wizard).
Rough idea:
* Change the PayInvoice wizard to allow a combination of deposits (if any are available) and a balance amount to pay at the start of the wizard.
* Pay the balance amount (excluding the deposits) as normal.
* Pay any deposit amounts by creating moves between the payable/receivable and deposit accounts, and link these to the original payment of the deposit (by setting its origin).
* Remove Recall Deposit wizard.
* Add an "Amount on Deposit" field onto the Payment Tab on Invoices.
The remaining amount (in both currencies, if applicable) of each individual deposit that has been paid can be calculated based on the original deposit payment minus all the amounts of the lines used to pay invoices.
When the deposits are used to pay invoices the same proportion of both currencies (if available) are used in the payment. This means that when any write-off is done any exchange rate fluctuations that have occurred between payment of the deposits and all other payments are taken in to account correctly.
I hope I have clearly explained this, and I'm happy to work on a review implementing it (or a better solution if there is a better way of doing this).