Merge lp:~openerp-dev/openobject-server/6.0-opw-577609-cbi into lp:openobject-server/6.0

Proposed by Chris Biersbach (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-577609-cbi
Merge into: lp:openobject-server/6.0
Diff against target: 15 lines (+5/-0)
1 file modified
bin/osv/expression.py (+5/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-577609-cbi
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+127743@code.launchpad.net

Description of the change

when the id field is redefined in an inheriting class, the test "if not field" is not true.

in this case, "id child_of ..." in expressions will not be correctly parsed, this will result in a traceback.

to reproduce, create a minimal addon with a class inheriting from account.account, redefining the id field.
when trying to delete an account, a traceback appears, because the check_moves test contains an "id child_of ..." expression.

this issue is fixed in this branch, by testing for the additional case of an id field of type integer

To post a comment you must log in.

Unmerged revisions

3641. By Chris Biersbach (OpenERP)

[FIX] This allows for id child_of ... in expressions when the id fiels is redefined in inheriting classes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/osv/expression.py'
2--- bin/osv/expression.py 2011-01-17 08:41:08 +0000
3+++ bin/osv/expression.py 2012-10-03 12:37:23 +0000
4@@ -178,6 +178,11 @@
5 self.__exp.insert(i + 2 + j, se)
6 # else, the value of the field is store in the database, so we search on it
7
8+ elif field._type == 'integer':
9+ if left == 'id' and operator == 'child_of':
10+ dom = _rec_get(right, working_table)
11+ self.__exp = self.__exp[:i] + dom + self.__exp[i+1:]
12+
13 elif field._type == 'one2many':
14 # Applying recursivity on field(one2many)
15 if operator == 'child_of':