From a8c122cd3112f05caebfa055c103247c1ff54766 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 16 Apr 2015 11:56:11 +0200 Subject: [PATCH] [FIX] ir.values: clear defaults cache when user company changes The defaults of ir.values depends on the user company, but there is no cache invalidation when the company of a user change. This fix adds the clearing of the default's cache in this case. Closes #6339 opw-629979 --- openerp/addons/base/res/res_users.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index 3327cbbdbdb..cb88cb186d7 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -334,6 +334,8 @@ class res_users(osv.osv): # if partner is global we keep it that way if user.partner_id.company_id and user.partner_id.company_id.id != values['company_id']: user.partner_id.write({'company_id': user.company_id.id}) + # clear default ir values when company changes + self.pool['ir.values'].get_defaults_dict.clear_cache(self.pool['ir.values']) # clear caches linked to the users self.pool['ir.model.access'].call_cache_clearing_methods(cr) clear = partial(self.pool['ir.rule'].clear_cache, cr)