Domain Evaluation : M2O with operator 'in' fails.

Bug #600216 reported by Ferdinand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Medium
Jay Vora (Serpent Consulting Services)

Bug Description

example (custom form)

this works
 <field name="domain">[('partner_id' ,'=' , 'Leerstehung'), ('to_date' ,'=', False) ]</field>

this not
 <field name="domain">[('partner_id' ,'in' , 'Leerstehung'), ('to_date' ,'=', False) ]</field>

- obviously I want to add some items to make 'in' meaningful ....

Environment Information :
System : Linux-2.6.31.12-0.2-desktop-x86_64-with-SuSE-11.2-x86_64
OS Name : posix
LSB Version: core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch
Distributor ID: SUSE LINUX
Description: openSUSE 11.2 (x86_64)
Release: 11.2
Codename: n/a
Operating System Release : 2.6.31.12-0.2-desktop
Operating System Version : #1 SMP PREEMPT 2010-03-16 21:25:39 +0100
Operating System Architecture : 64bit
Operating System Locale : de_DE.ISO8859-1
Python Version : 2.6.2
OpenERP-Client Version : 5.0.10
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/terp/OpenERP/branch/server/5.0/bin/netsvc.py", line 247, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/terp/OpenERP/branch/server/5.0/bin/netsvc.py", line 76, in __call__
    return getattr(self, method)(*params)
  File "/home/terp/OpenERP/branch/server/5.0/bin/addons/audittrail/audittrail.py", line 364, in execute
    return fct_src(db, uid, passwd, model, method, *args)
  File "/home/terp/OpenERP/branch/server/5.0/bin/addons/base_module_record/base_module_record.py", line 38, in execute
    res = super(recording_objects_proxy, self).execute(*args, **argv)
  File "/home/terp/OpenERP/branch/server/5.0/bin/service/web_services.py", line 577, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/osv.py", line 58, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/osv.py", line 119, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/osv.py", line 111, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 3027, in search
    (qu1, qu2, tables) = self._where_calc(cr, user, args, context=context)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 3007, in _where_calc
    e.parse(cr, user, self, context)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/expression.py", line 284, in parse
    res_ids = field_obj.name_search(cr, uid, right, [], operator, limit=None, context=c)
  File "/home/terp/OpenERP/branch/server/5.0/bin/addons/base/res/partner/partner.py", line 211, in name_search
    ids = self.search(cr, uid, [('name', operator, name)] + args, limit=limit, context=context)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 3054, in search
    cr.execute('select %s.id from ' % self._table + ','.join(tables) +qu1+' order by '+order_by+limit_str+offset_str, qu2)
  File "/home/terp/OpenERP/branch/server/5.0/bin/sql_db.py", line 77, in wrapper
    return f(self, *args, **kwargs)
  File "/home/terp/OpenERP/branch/server/5.0/bin/sql_db.py", line 122, in execute
    res = self._obj.execute(query, params)
IndexError: list index out of range

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hi,

It is not supposed to work with [('partner_id' ,'in' , 'Leerstehung')] because, whenever you supply IN operator, the right operand has to be either a tuple or a list.

[('partner_id' ,'in' , ['Leerstehung']) will work for you.

Thanks.

Changed in openobject-server:
milestone: none → 5.0.12
status: New → Invalid
Revision history for this message
Ferdinand (office-chricar) wrote :

unfortunatley not - first I tried this

<field name="domain">[('partner_id' ,'in' , ['Leerstehung']), ('to_date' ,'=', False) ]</field>

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Koo/Rpc/Rpc.py", line 151, in call
    result = self.singleCall( obj, method, *args )
  File "/usr/lib/python2.6/site-packages/Koo/Rpc/Rpc.py", line 140, in singleCall
    result = self.proxy.dispatch( obj[1:], method, self.databaseName, self.uid, self.password, *encodedArgs )
  File "/usr/lib64/python2.6/site-packages/Pyro/core.py", line 384, in __call__
    return self.__send(self.__name, args, kwargs)
  File "/usr/lib64/python2.6/site-packages/Pyro/core.py", line 459, in _invokePYRO
    return self.adapter.remoteInvocation(name, Pyro.constants.RIF_VarargsAndKeywords, vargs, kargs)
  File "/usr/lib64/python2.6/site-packages/Pyro/protocol.py", line 439, in remoteInvocation
    return self._remoteInvocation(method, flags, *args)
  File "/usr/lib64/python2.6/site-packages/Pyro/protocol.py", line 464, in _remoteInvocation
    answer = pickle.loads(answer)
AttributeError: 'module' object has no attribute 'DataError'

Changed in openobject-server:
status: Invalid → New
Revision history for this message
Ferdinand (office-chricar) wrote :

OpenERP-Client Version : 5.0.10
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/terp/OpenERP/branch/server/5.0/bin/netsvc.py", line 247, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/terp/OpenERP/branch/server/5.0/bin/netsvc.py", line 76, in __call__
    return getattr(self, method)(*params)
  File "/home/terp/OpenERP/branch/server/5.0/bin/addons/audittrail/audittrail.py", line 364, in execute
    return fct_src(db, uid, passwd, model, method, *args)
  File "/home/terp/OpenERP/branch/server/5.0/bin/addons/base_module_record/base_module_record.py", line 38, in execute
    res = super(recording_objects_proxy, self).execute(*args, **argv)
  File "/home/terp/OpenERP/branch/server/5.0/bin/service/web_services.py", line 577, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/osv.py", line 58, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/osv.py", line 119, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/osv.py", line 111, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 3054, in search
    cr.execute('select %s.id from ' % self._table + ','.join(tables) +qu1+' order by '+order_by+limit_str+offset_str, qu2)
  File "/home/terp/OpenERP/branch/server/5.0/bin/sql_db.py", line 77, in wrapper
    return f(self, *args, **kwargs)
  File "/home/terp/OpenERP/branch/server/5.0/bin/sql_db.py", line 122, in execute
    res = self._obj.execute(query, params)
DataError: invalid input syntax for integer: "Leerstehung"

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hi,

Alright, I will try it again and will post more.
Sorry for the delay.

Thanks.

Revision history for this message
filsys (office-filsystem) wrote : [Bug 600216] Re: xml domain filter works for '=' but not for 'in'

Hello,
Just for example, this sintax work fine:
<field name="location_dest_id" select="1"
domain="[('usage','in',('internal','production'))]"/>

summary: - xml domain filter works for '=' but not for 'in'
+ Domain Evaluation : M2O with operator 'in' fails.
Changed in openobject-server:
assignee: nobody → Jay (Open ERP) (jvo-openerp)
importance: Undecided → Medium
status: New → Confirmed
Changed in openobject-server:
status: Confirmed → In Progress
Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Dr Ferdinand,

  I have attached a solution here. Would you please check it and notify us.

Thanks.

Revision history for this message
Ferdinand (office-chricar) wrote :

thanks works for me

Revision history for this message
xrg (xrg) wrote : Re: [Bug 600216] Re: Domain Evaluation : M2O with operator 'in' fails.

On Saturday 10 July 2010, you wrote:
> Hello Dr Ferdinand,
>
> I have attached a solution here. Would you please check it and notify
> us.
>

I have put Anup's patch into my pg84 branch. Also wrote a few tests to verify
that all the cases we mentioned do work.

Note that in pg84, nested expressions also work, which will be faster than
name_search() and allow more explicit queries.

Look at server head 882d338b948de39

Changed in openobject-server:
milestone: 5.0.12 → 5.0.13
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

It has been fixed by revision 2090 <email address hidden>.
Thanks.

Changed in openobject-server:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.