Chris Biersbach (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/6.1-opw-577609-cbi into 
lp:openobject-server/6.1.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.1-opw-577609-cbi/+merge/127741

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
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.1-opw-577609-cbi/+merge/127741
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.1-opw-577609-cbi.
=== modified file 'openerp/osv/expression.py'
--- openerp/osv/expression.py	2012-01-24 12:42:52 +0000
+++ openerp/osv/expression.py	2012-10-03 12:32:20 +0000
@@ -486,6 +486,12 @@
                         for j, se in enumerate(subexp):
                             self.__exp.insert(i + 2 + j, se)
             # else, the value of the field is store in the database, so we search on it
+            
+            elif field._type == 'integer':
+                if left == 'id' and operator == 'child_of':
+                    ids2 = to_ids(right, table)
+                    dom = child_of_domain(left, ids2, working_table)
+                    self.__exp = self.__exp[:i] + dom + self.__exp[i+1:]
 
             elif field._type == 'one2many':
                 # Applying recursivity on field(one2many)

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to