From ef6522ccc8d11a157388a0ac5c6577995050d317 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Tue, 28 Feb 2012 16:25:08 +0100 Subject: [PATCH] [FIX] filter user context and client specific value from res.log context - We do not want to store user context (lang, timezone) and openerp client specific values (bin_size, client, _terp_view_name) as those value will be updated anyway (depending on user/client settings) when user access an res.log item. bzr revid: xal@openerp.com-20120228152508-5hjiqmezl2j6wbct --- bin/addons/base/res/res_log.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/addons/base/res/res_log.py b/bin/addons/base/res/res_log.py index 26e1eae..abca8b6 100644 --- a/bin/addons/base/res/res_log.py +++ b/bin/addons/base/res/res_log.py @@ -50,7 +50,19 @@ class res_log(osv.osv): self._index_name) def create(self, cr, uid, vals, context=None): + + def filter_context_value(c): + """filter unrequired value from context""" + # We remove user context and web client related value as those + # values will be re-set when accessing res.log item, depending + # on user or client settings + if isinstance(c, dict): + FILTER_OUT_KEYS = ['tz', 'lang', 'client', 'bin_size', '_terp_view_name'] + for context_key in FILTER_OUT_KEYS: + c.pop(context_key, None) + return c create_context = context and dict(context) or {} + create_context = filter_context_value(create_context) if 'res_log_read' in create_context: vals['read'] = create_context.pop('res_log_read') if create_context and not vals.get('context'): -- 1.7.10.4