Hi forum!
I try to calculate employees leaves and i get this error:
record.current_holiday_pool = total_holidays.remaining_count - total_record
TypeError: unsupported operand type(s) for -: 'int' and 'hr.holidays'
my method:
current_holiday_pool = fields.Integer(compute="_get_current_holiday_pool", store=True)
@api.multi
@api.depends('yearly_holidays_ids')
def _get_current_holiday_pool(self):
for record in self:
current_year = datetime.date.today().year
total_holidays = record.yearly_holidays_ids.filtered(lambda lm:lm.year == current_year)
total_record = total_holidays.mapped("holidays_ids").filtered(lambda lm:lm.holiday_status_id.name == 'annual')
record.current_holiday_pool = total_holidays.remaining_count - total_record
What do I do wrong?Thank you for your help!
Regards,
Steven