[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
This commit is contained in:
Nicolas Lempereur 2015-04-16 11:56:11 +02:00 committed by Olivier Dony
parent 8c40bdd410
commit a8c122cd31
1 changed files with 2 additions and 0 deletions

View File

@ -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)