[Openerp-community-reviewer] [Merge] lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order into lp:ocb-server

2014-11-24 Thread Holger Brunn (Therp)
The proposal to merge 
lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order into 
lp:ocb-server has been updated.

Status: Needs review = Rejected

For more details, see:
https://code.launchpad.net/~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order/+merge/209708
-- 
Your team OpenERP Community Backports is subscribed to branch lp:ocb-server.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


Re: [Openerp-community-reviewer] [Merge] lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order into lp:ocb-server

2014-06-30 Thread Alexandre Fayolle - camptocamp
https://github.com/odoo/odoo/pull/829
-- 
https://code.launchpad.net/~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order/+merge/209708
Your team OpenERP Community Backports is subscribed to branch lp:ocb-server.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


Re: [Openerp-community-reviewer] [Merge] lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order into lp:ocb-server

2014-04-25 Thread Alexandre Fayolle - camptocamp
Review: Needs Fixing code review, test

This patch breaks the yaml_import tests. 

Extract from the logs:

TEST test_ocb70 openerp.tools.yaml_import: 2. Duplicate the parent category and 
verify that the children have been duplicated too and are below the new parent
ERROR test_ocb70 openerp.tools.yaml_import: AssertionError in Python code : 
After duplication, previous record must have old childs records only
TEST test_ocb70 openerp.tools.yaml_import: 3. Duplicate the children then 
reassign them to the new parent (1st method) and check the parent_store 
structure.
ERROR test_ocb70 openerp.tools.yaml_import: AssertionError in Python code : 
After duplication, previous record must have old childs records only
TEST test_ocb70 openerp.tools.yaml_import: 4. Duplicate the children then 
reassign them to the new parent (2nd method) and check the parent_store 
structure.
ERROR test_ocb70 openerp.tools.yaml_import: AssertionError in Python code : 
After duplication, previous record must have old childs records only
TEST test_ocb70 openerp.tools.yaml_import: 5. Duplicate the children then 
reassign them to the new parent (3rd method) and make sure the parent_store 
structure is still right.
ERROR test_ocb70 openerp.tools.yaml_import: AssertionError in Python code : 
After duplication, previous record must have old childs records only

Can you please check this, and adapt the tests (which seem to have some 
assumptions broken by your changes) or fix the code in yaml_import?
-- 
https://code.launchpad.net/~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order/+merge/209708
Your team OpenERP Community Backports Team is subscribed to branch 
lp:ocb-server.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


[Openerp-community-reviewer] [Merge] lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order into lp:ocb-server

2014-03-06 Thread Cedric Le Brouster(OpenFire)
Cedric Le Brouster(OpenFire) has proposed merging 
lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order into 
lp:ocb-server.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1253052 in OpenERP Server: parent_left,parent_right are not recomputed 
when parent_order is changed
  https://bugs.launchpad.net/openobject-server/+bug/1253052

For more details, see:
https://code.launchpad.net/~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order/+merge/209708

Fixes parent_left and parent_right recomputation in write/create methods ( bug 
lp:1253052 )
-- 
https://code.launchpad.net/~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order/+merge/209708
Your team OpenERP Community Backports Team is requested to review the proposed 
merge of lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1253052-parent-order into 
lp:ocb-server.
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py	2014-03-05 15:18:15 +
+++ openerp/osv/orm.py	2014-03-06 14:40:28 +
@@ -4168,22 +4168,31 @@
 
 parents_changed = []
 parent_order = self._parent_order or self._order
-if self._parent_store and (self._parent_name in vals):
+if self._parent_store:
 # The parent_left/right computation may take up to
 # 5 seconds. No need to recompute the values if the
-# parent is the same.
+# parent and order field are the same.
 # Note: to respect parent_order, nodes must be processed in
 # order, so ``parents_changed`` must be ordered properly.
-parent_val = vals[self._parent_name]
-if parent_val:
-query = SELECT id FROM %s WHERE id IN %%s AND (%s != %%s OR %s IS NULL) ORDER BY %s % \
-(self._table, self._parent_name, self._parent_name, parent_order)
-cr.execute(query, (tuple(ids), parent_val))
-else:
-query = SELECT id FROM %s WHERE id IN %%s AND (%s IS NOT NULL) ORDER BY %s % \
-(self._table, self._parent_name, parent_order)
-cr.execute(query, (tuple(ids),))
-parents_changed = map(operator.itemgetter(0), cr.fetchall())
+query = SELECT id FROM %s WHERE id IN %%s % (self._table,)
+query_params = [tuple(ids)]
+query_clause = 
+parent_params = [self._parent_name]
+for param in parent_order.split(','):
+parent_params.append(param.strip())
+for parent_param in parent_params:
+if parent_param in vals:
+parents_changed = True
+parent_val = vals[parent_param]
+if parent_val:
+query_clause += (query_clause and ' OR ' or '') + %s != %%s OR %s IS NULL % (parent_param,parent_param)
+query_params.append(parent_val)
+else:
+query_clause += (query_clause and ' OR ' or '') + %s IS NOT NULL % (parent_param,)
+if parents_changed:
+query += (query_clause and (' AND (' + query_clause + ')') or '') +  ORDER BY %s % (self._parent_order,)
+cr.execute(query, tuple(query_params))
+parents_changed = map(operator.itemgetter(0), cr.fetchall())
 
 upd0 = []
 upd1 = []
@@ -4281,18 +4290,16 @@
 if self.pool._init:
 self.pool._init_parent[self._name] = True
 else:
-order = self._parent_order or self._order
-parent_val = vals[self._parent_name]
-if parent_val:
-clause, params = '%s=%%s' % (self._parent_name,), (parent_val,)
-else:
-clause, params = '%s IS NULL' % (self._parent_name,), ()
-
 for id in parents_changed:
-cr.execute('SELECT parent_left, parent_right FROM %s WHERE id=%%s' % (self._table,), (id,))
-pleft, pright = cr.fetchone()
+cr.execute('SELECT parent_left, parent_right, %s FROM %s WHERE id=%%s' % (self._parent_name, self._table,), (id,))
+pleft, pright, parent_val = cr.fetchone()
 distance = pright - pleft + 1
 
+if parent_val:
+clause, params = '%s=%%s' % (self._parent_name,), (parent_val,)
+else:
+clause, params = '%s IS NULL' % (self._parent_name,), ()
+
 # Positions of current siblings, to locate proper insertion point;
 # this can _not_ be fetched outside the loop, as it needs to be refreshed
 # after each update, in case several nodes are sequentially inserted one
@@ -4512,21 +4519,24 @@
 self.pool._init_parent[self._name] = True
 else:
 parent =