Odoo Help


OpenERP 7.0 WebService : search_read()

on 6/3/15, 5:59 AM 2,267 views


I'm doing a PHP app that need to retrieve products from Odoo.

I have OpenErp 7.0

I was wondering if the function search_read mentionned in the exemple in the link below, would work with OpenErp 7?


$products = $ripcord->execute_kw('myDB', 1, 'myPassword',
                    'product.template', 'search_read',
                        array('name', 'ilike', 'pixma'),
                        array('type', 'ilike', 'product'),
                    ['fields'=>array('name', 'description'), 'limit'=>5]

Because I get this error

 Array ( [faultCode] => 'product.template' object has no attribute 'search_read' [faultString] => Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/openerp-7.0-py2.7.egg/openerp/service/wsgi_server.py", line 82, in xmlrpc_return result = openerp.netsvc.dispatch_rpc(service, method, params) File "/usr/local/lib/python2.7/dist-packages/openerp-7.0-py2.7.egg/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/local/lib/python2.7/dist-packages/openerp-7.0-py2.7.egg/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, *params) File "/usr/local/lib/python2.7/dist-packages/openerp-7.0-py2.7.egg/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "/usr/local/lib/python2.7/dist-packages/openerp-7.0-py2.7.egg/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/openerp-7.0-py2.7.egg/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/local/lib/python2.7/dist-packages/openerp-7.0-py2.7.egg/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) AttributeError: 'product.template' object has no attribute 'search_read' ) 

And also.. It's taking a lot of time... how can I do to make it a little bit faster?

On 6/4/15, 10:40 AM

Thank you for the answer.

What do you mean by "web sessions"?

Any idea to make my research a little bit faster?

For now I'm doing a 'search' in product.template model to sort the ID of the products with name like the keyword entered

and then foreach IDs I do a 'read' to retrieve the info.

But it's really slow and I also need fields that are in other models... So I have to do it in many request and it takes a lot of time. And for big request I got timeout after 120s....

This is annoying and the project is due for the end of the week.

Turkesh Patel
On 6/4/15, 8:47 AM

Search_read method is available only in v8 so if you will call this method in v7 it will give you error. In  V7 there is search_read method for web sessions.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/3/15, 5:59 AM
Seen: 2267 times
Last updated: 6/4/15, 10:41 AM