hi in hr expense i add a new field in hr.expense.line named caissier_id i wanna that on adding a new element on expense.line , caissier_id get the value of , employee_id,
so in the hr_expense_line classe i tried some functions like that
function 1 :
def _employe_get(self, cr, uid, context=None):
res = {}
for record in self.browse(cr, uid, context=context):
payslip_obj = self.pool.get('hr.expense.expense')
payslip = payslip_obj.search([('id', '=', record.expense_id)], limit=1)
if payslip:
res[record.caissier_id] = payslip.employee_id.id
return res
this : retun nothing.
function 2 :
def _get_cur(self, cr, uid, context=None):
user = self.pool.get('hr.expense.expense').browse(cr, uid,[uid], context=context)[0]
return user.employee_id.id
this return a value that not the same as employe_id
function 3 :
def _employe1_get(self, cr, uid, id, context=None):
res = []
holiday_obj = self.pool['hr.expense.expense']
holiday_ids = holiday_obj.search(cr, uid, [], context=context)
holiday_datas = holiday_obj.browse(cr, uid, id, context=context).employee_id
for holiday in holiday_datas:
res.append({'caissier_id': holiday.employee_id})
return res
i get this error :
ValueError
Expected singleton: hr.expense.expense(u'lang', u'currency_id', u'tz', u'uid', u'default_analytic_account', u'caissier_id')
so can anyone help me or guid me , thnak you in advance