##############################################################################
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
return e
import yaml
-
-class record(yaml.YAMLObject):
- yaml_tag = u'!record'
- def __init__(self, model, id=None, attrs={}):
- self.model = model
- self.id = id
- self.attrs=attrs
- def __repr__(self):
- return '!record {model: %s, id: %s}:' % (str(self.model,), str(self.id,))
+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 workflow(yaml.YAMLObject):
- yaml_tag = u'!workflow'
- def __init__(self, model, action, ref=None):
- self.model = model
- self.ref = ref
- self.action=action
- def __repr__(self):
- return '!workflow {model: %s, action: %s, ref: %s}' % (str(self.model,), str(self.action,), str(self.ref,))
-
-class ref(yaml.YAMLObject):
- yaml_tag = u'!ref'
- def __init__(self, expr="False"):
- self.expr = expr
- def __repr__(self):
- return 'ref(%s)' % (str(self.expr,))
-
-class eval(yaml.YAMLObject):
- yaml_tag = u'!eval'
- def __init__(self, expr="False"):
- self.expr = expr
- def __repr__(self):
- return 'eval(%s)' % (str(self.expr,))
-
-class function(yaml.YAMLObject):
- yaml_tag = u'!python'
- def __init__(self, model, action=None,attrs={}):
- self.model = model
- self.action = action
- self.attrs=attrs
- def __repr__(self):
- return '!python {model: %s}: |' % (str(self.model), )
-
class base_module_record(osv.osv):
_name = "ir.module.record"
_columns = {
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