0
我想USER_ID在def read
選擇hr.employee 7
領域選擇hr.employee自動爲:
'tested_by':fields.many2one("hr.employee",string="Tested by"),
我想USER_ID在def read
選擇hr.employee 7
領域選擇hr.employee自動爲:
'tested_by':fields.many2one("hr.employee",string="Tested by"),
您需要使用_defaults
:
def _get_employee(self, cr, uid, context=None):
res = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=c)
return res and res[0] or False
_columns = {
'tested_by':fields.many2one("hr.employee",string="Tested by"),
}
_defaults = {
'tested_by': _get_employee,
}
謝謝你的答案,這是有幫助的 – Bobbi