From 4810513f3cb84e96888bd452577032c02652ed0c Mon Sep 17 00:00:00 2001 From: Denis Ledoux <dle@odoo.com> Date: Fri, 3 Jun 2016 17:03:13 +0200 Subject: [PATCH] [FIX] res_currency: company rates subselect The sub-select used to fetch companies rates was wrong in the case rates with no company set were entered before rates for specific companies. e.g., for USD, the below rates: Date Rate Company 2016-02-13 0.721400 2016-02-25 0.738800 1 2016-02-26 0.740000 1 the sub-select returned Rate Start End 0.721400 2016-02-13 0.738800 2016-02-25 2016-02-26 0.740000 2016-02-26 while it was expected to return Rate Start End 0.721400 2016-02-13 2016-02-25 0.738800 2016-02-25 2016-02-26 0.740000 2016-02-26 as the rate 0.721400 ended on 2016-02-25, since a new rate specific to this company 1 was added at that date. opw-678726 --- openerp/addons/base/res/res_currency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/res/res_currency.py b/openerp/addons/base/res/res_currency.py index bb87426b21a4..e0f5b68e7bac 100644 --- a/openerp/addons/base/res/res_currency.py +++ b/openerp/addons/base/res/res_currency.py @@ -262,7 +262,7 @@ class res_currency(osv.osv): (SELECT name FROM res_currency_rate r2 WHERE r2.name > r.name AND r2.currency_id = r.currency_id AND - (r2.company_id is null or r2.company_id = r.company_id) + (r2.company_id is null or r2.company_id = c.id) ORDER BY r2.name ASC LIMIT 1) AS date_end FROM res_currency_rate r -- GitLab