代码:
calds = env['day.calendar'].search([('employee_id','=',record.employee_id.id),('day','>=',record.start_date),('day','<=',record.end_date)])
eight_hours = True
if not calds:
eight_hours=False
for cald in calds:
if cald.working_hours!=8.0:
eight_hours=False
if not eight_hours and record.product_uom_id.name in ['Day(s)','天']:
raise ValidationError('您的排班非8小时班次,无法申请此类型假期!')
代码:
calds = env ['day.calendar'] .search( [('employee_id','=',record.employee_id.id),('day','>=',record.start_date),('day','<=',record.end_date)] )
eight_hours = True
if not calds:
eight_hours=False
for cald in calds:
if cald.working_hours!=8.0:
eight_hours=False
if not eight_hours and record.product_uom_id.name in ['Day(s)','天'] :
raise ValidationError('您的排班非8小时班次,无法申请此类型假期!')