Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
odoo9: many2one serach condition
Hello everybody!!!
Please can anyone help me know how to make a search on a many2one field.
Here is my code:
obj_contract = self.pool.get('hr.contract')
for emp in self.browse(cr, uid, ids, context=context):
contract_ids = obj_contract.search(cr, uid, [('employee_id', '=', emp.id)], order='date_start', context=context)
if contract_ids:
vals = obj_contract.read(cr,uid,contract_ids,['department_id'],context=context)
print contract_ids
print vals[0]['department_id']
if vals:
obj_department = self.pool.get('hr.department')
department_ids = obj_department.search(cr, uid, [('id', '=', vals[0]['department_id'])], order='id', context=context)
Thanks a lot in advance.
Best Regards.
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 4/23/16, 4:53 PM |
Seen: 686 times |
Last updated: 4/23/16, 4:53 PM |