annual_id = env['hr.holiday.type'].search([('code','=','L001')])
employee = record.employee_id
result = False
if record.holiday_type_id:
if record.holiday_type_id.code == 'L001':
processing_amount = 0
processing_recs = env['hr.holiday.leave'].search([('employee_id','=',employee.id),('state','=','waiting')])
for processing_rec in processing_recs:
processing_amount += processing_rec.leave_total
processing_amount += record.leave_total
inquiry_recs = env['hr.holiday.inquiry'].search([('employee_id','=',employee.id),('holiday_type_id','=',annual_id.id)])
balances=0
for inquiry_rec in inquiry_recs:
balances += inquiry_rec.balances
if processing_amount<=balances:
result = True
annual_id = env['hr.holiday.type'].search([('code','=','L001')])
employee = record.employee_id
result = False
if record.holiday_type_id:
if record.holiday_type_id.code == 'L001':
processing_amount = 0
processing_recs = env['hr.holiday.leave'].search([('employee_id','=',employee.id),('state','=','waiting')])
for processing_rec in processing_recs:
processing_amount += processing_rec.leave_total
processing_amount += record.leave_total
inquiry_recs = env['hr.holiday.inquiry'].search([('employee_id','=',employee.id),('holiday_type_id','=',annual_id.id)])
balances=0
for inquiry_rec in inquiry_recs:
balances += inquiry_rec.balances
if processing_amount>balances:
result = True