From 332adff573e66113605f1730ffd5bff2deeaddfb Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Tue, 9 Aug 2016 14:12:27 +0200 Subject: [PATCH] [FIX] base: set current company as default for currency rates When manually creating/importing a currency rate, there is no default on the company_id field. This is quite unfortunate, as rates are filtered by company then by date, which means that a rate without company will never be taken into account despite being newer. This filter makes sense for multi company setups, but for mono-company setups this is quite annoying. This commit adds a default on the company_id and adds a view for the base_currency_rate model to only display the company field in multi company settings. --- openerp/addons/base/res/res_currency.py | 1 + openerp/addons/base/res/res_currency_view.xml | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/openerp/addons/base/res/res_currency.py b/openerp/addons/base/res/res_currency.py index e0f5b68e7ba..97a87da4602 100644 --- a/openerp/addons/base/res/res_currency.py +++ b/openerp/addons/base/res/res_currency.py @@ -282,6 +282,7 @@ class res_currency_rate(osv.osv): } _defaults = { 'name': lambda *a: time.strftime('%Y-%m-%d 00:00:00'), + 'company_id': lambda s, cr, uid, ctx=None: s.pool['res.users']._get_company(cr, uid, context=ctx) } _order = "name desc" diff --git a/openerp/addons/base/res/res_currency_view.xml b/openerp/addons/base/res/res_currency_view.xml index 5721688225f..1dcabe8f34d 100644 --- a/openerp/addons/base/res/res_currency_view.xml +++ b/openerp/addons/base/res/res_currency_view.xml @@ -23,6 +23,28 @@ + + res.currency.rate.form + res.currency.rate + +
+ + + + + + + + + + + + + +
+
+
+