Odoo Help


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.


Difference between using cr param and ORM in any openerp class methods?

Abegail Sanchez
on 10/27/14, 4:29 AM 900 views

Is there any speed issue when using CR and ORM specially in querying records (e.g. getting all records in table)?

using cr:

*cr.execute('SELECT * FROM Table')

using ORM:

*self.search(cr,uid,[],context=None) or



Ludo - Neobis

--Ludo - Neobis--
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--


Ludo - Neobis
On 10/27/14, 4:54 AM

Not that I know of. Sometimes queries should perform better because you directly relate to the required fields and skip the other fields.

Do note however: Relational fields and fields using "store = false" will NOT show in the database. So if you run a query on the object, those fields will be impossible to retrieve. Therefor, the ORM has a slight advantage.

HAd some cases where lenght of domain is restricted to 256 characters... so ORM has a benefit of user acces rights check, and can read functional fields; while sql approach is better and faster for more complex data select... also much faster when taking big datasets on models ( 100k + records)

on 10/28/14, 5:43 AM

Tha't I've noticed on a transactional table specially in stock move model. I had thousands of records in the table and I need to get the quantity of products per location and I just wondering why too slow to query them. In fact qty available field in product model uses the same model but I noticed it is using CR approach so it came to my mind to post this kind of doubt.

Abegail Sanchez
on 10/28/14, 9:17 PM

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)


Asked: 10/27/14, 4:29 AM
Seen: 900 times
Last updated: 3/16/15, 8:10 AM