Yogesh(Open ERP) has proposed merging
lp:~openerp-dev/openobject-server/trunk-bug-711919-ysa into
lp:openobject-server.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
Related bugs:
Bug #711919 in OpenERP Server: "[TRUNK 3330] Search on mixed conditions
including one2many and active=False is wrongly interpreted"
https://bugs.launchpad.net/openobject-server/+bug/711919
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-711919-ysa/+merge/63356
--
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-711919-ysa/+merge/63356
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-server/trunk-bug-711919-ysa.
=== modified file 'openerp/osv/expression.py'
--- openerp/osv/expression.py 2011-02-07 12:57:23 +0000
+++ openerp/osv/expression.py 2011-06-03 10:08:00 +0000
@@ -108,6 +108,10 @@
self.__main_table = table
self.__all_tables.add(table)
+ active = False
+ for exp in self.__exp:
+ if exp[0] == 'active':
+ active = exp
i = -1
while i + 1<len(self.__exp):
i += 1
@@ -150,7 +154,10 @@
# Making search easier when there is a left operand as field.o2m or field.m2m
if field._type in ['many2many','one2many']:
right = field_obj.search(cr, uid, [(fargs[1], operator, right)], context=context)
- right1 = table.search(cr, uid, [(fargs[0],'in', right)], context=context)
+ if active:
+ right1 = table.search(cr, uid, [(fargs[0],'in', right),active], context=context)
+ else:
+ right1 = table.search(cr, uid, [(fargs[0],'in', right)], context=context)
if right1 == []:
self.__exp[i] = ( 'id', '=', 0 )
else:
@@ -292,12 +299,12 @@
else:
def _get_expression(field_obj,cr, uid, left, right, operator, context=None):
if context is None:
- context = {}
+ context = {}
c = context.copy()
c['active_test'] = False
#Special treatment to ill-formed domains
operator = ( operator in ['<','>','<=','>='] ) and 'in' or operator
-
+
dict_op = {'not in':'!=','in':'=','=':'in','!=':'not in','<>':'not in'}
if isinstance(right,tuple):
right = list(right)
@@ -319,7 +326,7 @@
elif isinstance(right,(list,tuple)):
m2o_str = True
for ele in right:
- if not isinstance(ele, basestring):
+ if not isinstance(ele, basestring):
m2o_str = False
break
elif right == []:
@@ -335,7 +342,7 @@
new_op = '!='
#Is it ok to put 'left' and not 'id' ?
self.__exp[i] = (left,new_op,False)
-
+
if m2o_str:
self.__exp[i] = _get_expression(field_obj,cr, uid, left, right, operator, context=context)
else:
_______________________________________________
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