improve_speed
bzr revid: fp@tinyerp.com-20100918143559-hcgi2x1af0pyt1ph
This commit is contained in:
parent
73dd053588
commit
c3ec58b1a4
|
@ -147,7 +147,7 @@ class ir_property(osv.osv):
|
||||||
elif record.type == 'binary':
|
elif record.type == 'binary':
|
||||||
return record.value_binary
|
return record.value_binary
|
||||||
elif record.type == 'many2one':
|
elif record.type == 'many2one':
|
||||||
return record.value_reference.id
|
return record.value_reference
|
||||||
elif record.type == 'datetime':
|
elif record.type == 'datetime':
|
||||||
return record.value_datetime
|
return record.value_datetime
|
||||||
elif record.type == 'date':
|
elif record.type == 'date':
|
||||||
|
|
|
@ -895,7 +895,7 @@ class property(function):
|
||||||
for prop_rec in prop.browse(cr, uid, ids, context=context):
|
for prop_rec in prop.browse(cr, uid, ids, context=context):
|
||||||
if prop_rec.fields_id.name in default_value:
|
if prop_rec.fields_id.name in default_value:
|
||||||
continue
|
continue
|
||||||
default_value[prop_rec.fields_id.name] = prop.get_by_record(cr, uid, prop_rec, context=context)
|
default_value[prop_rec.fields_id.name] = prop.get_by_record(cr, uid, prop_rec, context=context) or False
|
||||||
return default_value
|
return default_value
|
||||||
|
|
||||||
def _get_by_id(self, obj, cr, uid, prop_name, ids, context=None):
|
def _get_by_id(self, obj, cr, uid, prop_name, ids, context=None):
|
||||||
|
@ -910,6 +910,7 @@ class property(function):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: to rewrite more clean
|
||||||
def _fnct_write(self, obj, cr, uid, id, prop_name, id_val, obj_dest, context=None):
|
def _fnct_write(self, obj, cr, uid, id, prop_name, id_val, obj_dest, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
@ -950,9 +951,24 @@ class property(function):
|
||||||
for id in ids:
|
for id in ids:
|
||||||
res[id] = default_val.copy()
|
res[id] = default_val.copy()
|
||||||
|
|
||||||
for prop in properties.browse(cr, uid, nids, context=context):
|
replaces = {}
|
||||||
|
brs = properties.browse(cr, uid, nids, context=context)
|
||||||
|
for prop in brs:
|
||||||
value = properties.get_by_record(cr, uid, prop, context=context)
|
value = properties.get_by_record(cr, uid, prop, context=context)
|
||||||
res[prop.res_id.id][prop.fields_id.name] = value or False
|
res[prop.res_id.id][prop.fields_id.name] = value or False
|
||||||
|
if value:
|
||||||
|
replaces.setdefault(value._name, {})
|
||||||
|
replaces[value._name][value.id] = True
|
||||||
|
|
||||||
|
for rep in replaces:
|
||||||
|
replaces[rep] = dict(obj.pool.get(rep).name_get(cr, uid, replaces[rep].keys(), context=context))
|
||||||
|
|
||||||
|
for prop in brs:
|
||||||
|
if prop.type == 'many2one':
|
||||||
|
for id in ids:
|
||||||
|
if res[id][prop.fields_id.name]:
|
||||||
|
res[id][prop.fields_id.name] = replaces[res[id][prop.fields_id.name]._name].get(res[id][prop.fields_id.name], False)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue