因获取不到假期额度表内的去年年假数据,只能查找去年结转过来的记录,然后减去今天休假额度已申请的天数,得到结果
for record in self:
detail = self.env['hr.holiday.transfer.detail'].search([('transfer_period_after','=',record.holiday_package_id.holiday_period_id.id),('state','=','done'),('employee_id','=',record.id),('holiday_type_id','=',5)])
inquery = self.env['hr.holiday.inquiry'].search([('holiday_period_id','=',record.holiday_package_id.holiday_period_id.id),('employee_id','=',record.id),('holiday_type_id','=',5)])
balance=detail.transfer_num - inquery.used_num
if balance <= 0:
record['x_nxj'] = 0
else:
record['x_nxj'] = balance
for record in self:
detail = self.env['hr.holiday.transfer.detail'].search([('transfer_period_after','=',record.holiday_package_id.holiday_period_id.id),('state','=','done'),('employee_id','=',record.id),('holiday_type_id','=',21)])
inquery = self.env['hr.holiday.inquiry'].search([('holiday_period_id','=',record.holiday_package_id.holiday_period_id.id),('employee_id','=',record.id),('holiday_type_id','=',21)])
balance=detail.transfer_num - inquery.used_num
if balance <= 0:
record['x_mnxj'] = 0
else:
record['x_mnxj'] = balance