If the calculated ending balance is still an issue, here is a patch which will fix it. Please check it.
I introduce 2 fields to the bank statement lines - cash_discount and transferred_amount - which will automatically be filled by the invoice selection wizard. I also overload the _end_balance method so it calculates the ending balance as (amount - cash_discount) in state "draft" now.
If the calculated ending balance is still an issue, here is a patch which will fix it. Please check it.
I introduce 2 fields to the bank statement lines - cash_discount and transferred_amount - which will automatically be filled by the invoice selection wizard. I also overload the _end_balance method so it calculates the ending balance as (amount - cash_discount) in state "draft" now.