跳至內容
選單
此問題已被標幟
3126 瀏覽次數

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.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
3月 15
3684
3
2月 25
35587
2
2月 25
8688
1
9月 24
2319
3
7月 24
24733