Odoo Help

Welcome!

This community 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.

0

OpenERP 7.0 WebService : search_read()

By
aluna
on 6/3/15, 5:59 AM 1,196 views

Hi,

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?

https://www.odoo.com/documentation/8.0/api_integration.html#search-and-read 

$products = $ripcord->execute_kw('myDB', 1, 'myPassword',
                    'product.template', 'search_read',
                    array(
                        array(
                        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?





1
aluna
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.

1
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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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