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

« back to all changes in this revision

Viewing changes to bin/osv/orm.py

  • Committer: Anup(OpenERP)
  • Date: 2011-02-04 09:32:33 UTC
  • Revision ID: ach@openerp.com-20110204093233-hg98eemjg6awz3g2
[FIX] orm : Miscalculation of parent_left/parent_right corrected.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2712
2712
                    clause, params = '%s=%%s' % (self._parent_name,), (parent_val,)
2713
2713
                else:
2714
2714
                    clause, params = '%s IS NULL' % (self._parent_name,), ()
2715
 
                cr.execute('SELECT parent_right, id FROM "%s" WHERE %s ORDER BY %s' % (self._table, clause, order), params)
2716
 
                parents = cr.fetchall()
2717
2715
 
2718
2716
                for id in parents_changed:
2719
2717
                    cr.execute('SELECT parent_left, parent_right FROM "%s" WHERE id=%%s' % (self._table,), (id,))
2720
2718
                    pleft, pright = cr.fetchone()
2721
2719
                    distance = pright - pleft + 1
2722
 
 
 
2720
                                                
 
2721
                    cr.execute('SELECT parent_right, id FROM "%s" WHERE %s ORDER BY %s' % (self._table, clause, order), params)
 
2722
                    parents = cr.fetchall()
 
2723
                    
2723
2724
                    # Find Position of the element
2724
2725
                    position = None
2725
2726
                    for (parent_pright, parent_id) in parents: