我我的模型,我有一個字段「mentor_id」被定義爲:獲取當前用戶的員工ID在XML文件odoo 10
mentor_id = fields.Many2one('hr.employee', string='Mentor')
在我搜索查看我需要添加一個過濾器,只顯示記錄與mentor_id =當前用戶的EMPLOYEE_ID 所以我說:
<filter string="My :" name="my" domain="[('mentor_id','in',uid.employee_ids)]"/>
但它似乎並沒有工作,我得到這個錯誤:
Uncaught Error: Failed to evaluate search criterions:
{"code":400,"message":"Evaluation Error","data":{"type":"local_exception","debug":"Local evaluation failure\nAttributeError: object has no attribute 'employee_ids'\n\n{\"domains\":[[],\"[('mentor_id','in',uid.employee_ids)]\"],\"contexts\":[{\"lang\":\"en_US\",\"tz\":false,\"uid\":1,\"params\":{\"action\":324}},{}],\"group_by_seq\":[]}"}}
uid是指當前用戶是不是?那麼爲什麼錯誤說:「該對象沒有屬性'employee_ids'」。 任何幫助,將不勝感激。
這是一個這裏的答案很好。好的想法 – Cherif
@CherifOdoo謝謝。 – Majikat