'Will return the groups and the end dates of the intervals of the purchase calendar
that need to be executed now.
If a purchase calendar is defined, it should give the
:return [(date, group)]'

def _get_group(self):

    Attendance = self.env['resource.calendar.attendance']
    group = False
    date = False
    now_date = datetime.utcnow()
    res_intervals = []
    if (self.purchase_calendar_id and self.purchase_calendar_id.attendance_ids):
        if self.last_execution_date:
            new_date = datetime.strptime(self.last_execution_date, DEFAULT_SERVER_DATETIME_FORMAT)
        else:
            new_date = datetime.utcnow()
        intervals = self.purchase_calendar_id._schedule_days(1, new_date, compute_leaves=True)
        for interval in intervals:
            if ((self.last_execution_date and ((interval[0] > new_date) and (interval[0] < now_date))) or ((not self.last_execution_date) and (interval[0] < now_date) and (interval[1] > now_date))):
                group = Attendance.browse(interval[2]).group_id.id
                date = interval[1]
                res_intervals += [(date, group)]
    else:
        return [(now_date, None)]
    return res_intervals
