odoo/odoo — pull request #1295 by rgo-odoo (2014-07-21 09:03:04+00:00)
Title: [FIX] Fixed the issues mentioned in 3 different tickets when it's a mult...

...i-currency scenario where the root cause is same that is, wrong exchange entries created.(Courtesy: Dharti, from LP branch 7.0-opw-596883-dhr). (Maintenance Case: 604876,609661,596883)

This branch fixes the issues which are faced when dealing in multi-currency, more information is as below,

Steps to reproduce(opw: 609661) with company currency set to EUR:
1) Create Sales, Sales Refund and Bank/Cash journals with USD as it's secondary currency and use them in below transactions for customer X,
2) Make an advance payment of 1000 USD through Bank statement,
3) Create a customer invoice of 1200 USD and validate it,
4) Create a customer payment for customer X and pay the invoice with 1000 USD and keep the invoice open

Issue: You will find an extra exchange entry with -2000 Amount Currency

Steps to reproduce mentioned in opw 604876:
1) Make an advance payment of 1000 USD for customer Y through "Customer Refunds" dated 01/01/2014 @ rate 1.2834 for USD,
2) Create a customer invoice of 1000 USD for same customer 06/06/2014 @ rate 1.5289,
3) Create a customer payment in USD for customer Y and reconcile it fully and validate it @ rate 1.8(create a rate for today)

Issue: Apart from the above issue, the customer refund stays open(it should have been set to "paid") with wrong balance, 2000 USD, though the related customer invoice goes to "paid" state.

I made some changes to the https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-opw-596883-dhr/+merge/183402 to fix the above issue(opw 604876).

Kindly review it.