credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #05117
lp:~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives into lp:openupgrade-server
Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives into lp:openupgrade-server.
Requested reviews:
OpenUpgrade Committers (openupgrade-committers)
Related bugs:
Bug #1131653 in OpenUpgrade Server: "[7.0] _check_recursion gives false positive if ids include a parent/child pair"
https://bugs.launchpad.net/openupgrade-server/+bug/1131653
For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives/+merge/150053
The bug that this branch aims to fix was discovered when testing the migration scripts for the base module.
--
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives/+merge/150053
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives into lp:openupgrade-server.
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py 2013-02-19 21:32:25 +0000
+++ openerp/osv/orm.py 2013-02-22 14:20:30 +0000
@@ -1943,7 +1943,10 @@
msg = "\n * ".join([r[0] for r in res])
msg += "\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model"
_logger.error(msg)
- raise except_orm('View error', msg)
+ # OpenUpgrade: do not raise for unknown fields, as these
+ # can be triggered on old views that still have to be
+ # replaced by the upgrade procedure
+ # raise except_orm('View error', msg)
return arch, fields
def _get_default_form_view(self, cr, user, context=None):
@@ -5084,18 +5087,24 @@
if not parent:
parent = self._parent_name
- ids_parent = ids[:]
- query = 'SELECT distinct "%s" FROM "%s" WHERE id IN %%s' % (parent, self._table)
+ # OpenUpgrade: include a fix for https://bugs.launchpad.net/bugs/1131653
+ # as this bug was discovered writing default values for new fields
+ query = 'SELECT id, "%s" FROM "%s" WHERE id IN %%s' % (parent, self._table)
+ ids_parent = ids
+ hierarchy = []
while ids_parent:
ids_parent2 = []
- for i in range(0, len(ids), cr.IN_MAX):
+ for i in range(0, len(ids_parent), cr.IN_MAX):
sub_ids_parent = ids_parent[i:i+cr.IN_MAX]
cr.execute(query, (tuple(sub_ids_parent),))
- ids_parent2.extend(filter(None, map(lambda x: x[0], cr.fetchall())))
+ for row in cr.fetchall():
+ if row[1]:
+ if row in hierarchy:
+ return False
+ hierarchy.append(row)
+ if row[1] not in ids_parent2:
+ ids_parent2.append(row[1])
ids_parent = ids_parent2
- for i in ids_parent:
- if i in ids:
- return False
return True
def _get_external_ids(self, cr, uid, ids, *args, **kwargs):
Follow ups