~clearcorp-drivers/openobject-server/5.0-ccorp

« back to all changes in this revision

Viewing changes to bin/osv/orm.py

  • Committer: Jay Vora(OpenERP)
  • Date: 2011-01-18 21:59:10 UTC
  • Revision ID: jvo@tinyerp.com-20110118215910-upzzqerxpzminekv
[FIX] write() : Correction to avoid overwriting of variable ids and optimization for store compuation:Backported from 6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
2748
2748
                        cr.execute('update '+self._table+' set parent_left=parent_left-%s, parent_right=parent_right-%s where parent_left>=%s and parent_left<%s', (pleft-position+distance,pleft-position+distance, pleft+distance, pright+distance))
2749
2749
 
2750
2750
        result += self._store_get_values(cr, user, ids, vals.keys(), context)
2751
 
        for order, object, ids, fields in result:
2752
 
            self.pool.get(object)._store_set_values(cr, user, ids, fields, context)
2753
 
 
 
2751
        done = {}
 
2752
        for order, object, ids_to_update, fields_to_recompute in result:
 
2753
            key = (object, tuple(fields_to_recompute))
 
2754
            done.setdefault(key, {})
 
2755
            # avoid to do several times the same computation
 
2756
            todo = []
 
2757
            for id in ids_to_update:
 
2758
                if id not in done[key]:
 
2759
                    done[key][id] = True
 
2760
                    todo.append(id)
 
2761
            self.pool.get(object)._store_set_values(cr, user, todo, fields_to_recompute, context)
 
2762
            
2754
2763
        wf_service = netsvc.LocalService("workflow")
2755
2764
        for id in ids:
2756
2765
            wf_service.trg_write(user, self._name, id, cr)