[MERGE] merge with main addons
[odoo/odoo.git] / addons / base_module_record / base_module_record.py
index f2927de..af63a0c 100644 (file)
 ##############################################################################
 
 from xml.dom import minidom
-from osv.osv import osv_pool
 from osv import fields,osv
-import netsvc
 import pooler
 import string
 import tools
 
-#objects_proxy = netsvc.ExportService.getService('object').__class__
-class recording_objects_proxy(osv_pool):
-    def execute(self, *args, **argv):
-        if args[3] == 'create':
-            _old_args = args[4].copy()
-        elif args[3] == 'write':
-            _old_args = args[5].copy()
-        elif len(args) >= 5 and isinstance(args[4], dict):
-            _old_args = args[4].copy()
-        elif len(args) > 5 and args[3] != 'write' and isinstance(args[5], dict):
-            _old_args = args[5].copy()
-        else:
-            _old_args = None
-        res = super(recording_objects_proxy, self).execute(*args, **argv)
-        pool = pooler.get_pool(args[0])
-        mod = pool.get('ir.module.record')
-        
-        if mod and mod.recording:
-            if args[3] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink'):
-                if _old_args is not None:
-                    if args[3] != 'write' and args[3] != 'create' and len(args) > 5 and isinstance(args[5], dict):
-                       args=list(args) 
-                       args[5]=_old_args
-                       args=tuple(args)
-                       mod.recording_data.append(('osv_memory_action', args, argv ,None))
-                    else:
-                       if args[3] == 'create':
-                           args[4].update(_old_args)
-                       elif args[3] == 'write':
-                           args[5].update(_old_args)
-                       mod.recording_data.append(('query', args, argv,res))
-        return res
-
-    def exec_workflow(self, *args, **argv):
-        res = super(recording_objects_proxy, self).exec_workflow(*args, **argv)
-        pool = pooler.get_pool(args[0])
-        mod = pool.get('ir.module.record')
-        if mod and mod.recording:
-            mod.recording_data.append(('workflow', args, argv))
-        return res
 
-recording_objects_proxy()
-      
 class xElement(minidom.Element):
     """dom.Element with compact print
     The Element in minidom has a problem: if printed, adds whitespace
@@ -88,7 +44,7 @@ def doc_createXElement(xdoc, tagName):
         return e
 
 import yaml
-from tools import yaml_tag
+from tools import yaml_tag # This import is not unused! Do not remove!
 # Please do not override yaml_tag here: modify it in server bin/tools/yaml_tag.py
 
 class base_module_record(osv.osv):
@@ -148,7 +104,8 @@ class base_module_record(osv.osv):
         for key,val in data.items():
             if not (val or (fields[key]['type']=='boolean')):
                 continue
-            if fields[key]['type'] in ('integer','float'):
+            if (fields[key]['type'] in ('integer','float') or
+                fields[key]['type'] == 'selection' and isinstance(val, int)):
                 field = doc.createElement('field')
                 field.setAttribute("name", key)
                 field.setAttribute("eval", val and str(val) or 'False' )
@@ -180,9 +137,9 @@ class base_module_record(osv.osv):
                 for valitem in (val or []):
                     if valitem[0] in (0,1):
                         if key in model_pool._columns:
-                            fname = model_pool._columns[key]._fields_id
+                            model_pool._columns[key]._fields_id
                         else:
-                            fname = model_pool._inherit_fields[key][2]._fields_id
+                            model_pool._inherit_fields[key][2]._fields_id
                         if valitem[0] == 0:
                             newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2])
                             valitem[1]=newid