Odoo Help

3

2
2 Answers
1
Serge Canada
4/7/14, 12:54 PM

if you already have that, and no realy need, replace it by a read

employee_data = employee_obj.browse( cr, uid, ids, context=context)

like

for employee in employee_obj.read( cr, uid, ids, ['contract_ids'], context=context):
    #So in employee['contract_ids'], you have a list of all contract id for this employee
1
Turkesh Patel (tpa) India
4/10/13, 4:27 AM

option a is right way as option b dose not make any sense. we can say it is mistake of coding in IMO.

--> there is one big plus point of option a: As it will avoids search on object so it will good if you have lots of records in db.

3 Comments
Serge Canada
4/7/14, 12:55 PM

option 1 , is a no sense, browse will read ALL field in db, so performance drop, trace the code, if you have 80 fields in the table, openerp will create a select query for 80 fields. Always avoid Browse, browse is for lazy programmer.

Turkesh Patel (tpa) India
4/8/14, 2:41 AM

what if you have 10-20 lakh records and you fire search query then it will take less time than browse of 80 fields????? in this case search makes no sense.

Serge Canada
4/8/14, 10:59 AM

No need a search if you already have the IDS, if you do a browse, mean you have IDS, so do a READ not a BROWSE.

Ask a Question
Keep Informed
3 follower(s)
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.

Register
Odoo Training Center

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

Test it now