Speed Improvement on Every Operation:
Removed Inherit Stuff bzr revid: fp@tinyerp.com-20080716200532-iec6d4jfelwhi5rt
This commit is contained in:
parent
d90ead399a
commit
694f88319c
|
@ -2,13 +2,6 @@
|
|||
-- Pure SQL
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE inherit (
|
||||
obj_type varchar(128) not null,
|
||||
obj_id int not null,
|
||||
inst_type varchar(128) not null,
|
||||
inst_id int not null
|
||||
);
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- IR dictionary
|
||||
-------------------------------------------------------------------------
|
||||
|
@ -336,3 +329,4 @@ CREATE TABLE ir_model_data (
|
|||
res_id integer, primary key(id)
|
||||
);
|
||||
|
||||
INSERT INTO ir_model_data (name,date_init,date_update,module,model,res_id) VALUES (%s, now(), now(), 'base', 'ir.model', %s)
|
||||
|
|
|
@ -1839,10 +1839,6 @@ class orm(orm_template):
|
|||
_('You try to bypass an access rule (Document type: %s).') % \
|
||||
self._description)
|
||||
|
||||
cr.execute('delete from inherit ' \
|
||||
'where (obj_type=%s and obj_id in ('+str_d+')) ' \
|
||||
'or (inst_type=%s and inst_id in ('+str_d+'))',
|
||||
(self._name,)+tuple(sub_ids)+(self._name,)+tuple(sub_ids))
|
||||
if d1:
|
||||
cr.execute('delete from "'+self._table+'" ' \
|
||||
'where id in ('+str_d+')'+d1, sub_ids+d2)
|
||||
|
@ -2086,7 +2082,6 @@ class orm(orm_template):
|
|||
upd0 += ','+self._inherits[table]
|
||||
upd1 += ',%d'
|
||||
upd2.append(id)
|
||||
cr.execute('insert into inherit (obj_type,obj_id,inst_type,inst_id) values (%s,%d,%s,%d)', (table,id,self._name,id_new))
|
||||
|
||||
for field in vals:
|
||||
if self._columns[field]._classic_write:
|
||||
|
|
|
@ -78,20 +78,8 @@ class osv_pool(netsvc.Service):
|
|||
'Object %s doesn\'t exist' % str(obj))
|
||||
if (not method in getattr(object,'_protected')) and len(args) \
|
||||
and args[0] and len(object._inherits):
|
||||
types = {obj: args[0]}
|
||||
cr.execute('select inst_type,inst_id,obj_id \
|
||||
from inherit \
|
||||
where obj_type=%s \
|
||||
and obj_id in ('+','.join(map(str,args[0]))+')', (obj,))
|
||||
for ty,id,id2 in cr.fetchall():
|
||||
if not ty in types:
|
||||
types[ty]=[]
|
||||
types[ty].append(id)
|
||||
types[obj].remove(id2)
|
||||
for t,ids in types.items():
|
||||
if len(ids):
|
||||
object_t = pooler.get_pool(cr.dbname).get(t)
|
||||
res = getattr(object_t,method)(cr, uid, ids, *args[1:], **kw)
|
||||
object_t = pooler.get_pool(cr.dbname).get(obj)
|
||||
res = getattr(object_t,method)(cr, uid, args, **kw)
|
||||
else:
|
||||
res = getattr(object,method)(cr, uid, *args, **kw)
|
||||
return res
|
||||
|
|
|
@ -290,11 +290,14 @@ class graph(object):
|
|||
return self.result
|
||||
|
||||
if __name__=='__main__':
|
||||
starting_node = ['mrp'] # put here nodes with flow_start=True
|
||||
nodes = ['project','account','hr','base','product','mrp','test']
|
||||
starting_node = ['profile'] # put here nodes with flow_start=True
|
||||
nodes = ['project','account','hr','base','product','mrp','test','profile']
|
||||
transitions = [
|
||||
('profile','mrp'),
|
||||
('mrp','project'),
|
||||
('project','product'),
|
||||
('mrp','hr'),
|
||||
('mrp','test'),
|
||||
('project','account'),
|
||||
('project','hr'),
|
||||
('product','base'),
|
||||
|
|
Loading…
Reference in New Issue