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)
vals = obj_contract.read(cr,uid,contract_ids,['department_id'],context=context)
obj_department = self.pool.get('hr.department')
department_ids = obj_department.search(cr, uid, [('id', '=', vals['department_id'])], order='id', context=context)
Thanks a lot in advance.
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
|Asked: 4/23/16, 4:53 PM|
|Seen: 318 times|
|Last updated: 4/23/16, 4:53 PM|