fix bug "index out of range"
authorChristophe Simonis <christophe@tinyerp.com>
Thu, 9 Oct 2008 12:54:24 +0000 (14:54 +0200)
committerChristophe Simonis <christophe@tinyerp.com>
Thu, 9 Oct 2008 12:54:24 +0000 (14:54 +0200)
bzr revid: christophe@tinyerp.com-20081009125424-4v5r4di0i3uzvzrd

addons/base_module_record/base_module_record.py

index e01ec76..32e6a82 100644 (file)
@@ -210,14 +210,16 @@ base_module_record()
 
 def fnct_call(fnct):
     def execute(*args, **argv):
-        if type(args[5])==type({}):
-            _old_args=args[5].copy()
+        if len(args) >= 6 and isinstance(args[5], dict):
+            _old_args = args[5].copy()
+        else:
+            _old_args = None
         res = fnct(*args, **argv)
         pool = pooler.get_pool(args[0])
         mod = pool.get('ir.module.record')
         if mod and mod.recording:
             if args[4] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc'):
-                if type(args[5])==type({}):
+                if _old_args is not None:
                     args[5].update(_old_args)
                 mod.recording_data.append(('query', args, argv,res))
         return res