Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Recruitment

Entity: hr.candidate

Compute Method: _compute_meeting_display

Inputs Method Outputs
candidate_with_meetings = self.filtered('meeting_ids')
(self - candidate_with_meetings).update({
            'meeting_display_text': _('No Meeting'),
            'meeting_display_date': ''
        })
today = fields.Date.today()
for candidate in candidate_with_meetings:
            count = len(candidate.meeting_ids)
            dates = candidate.meeting_ids.mapped('start')
            min_date, max_date = min(dates).date(), max(dates).date()
            if min_date >= today:
                candidate.meeting_display_date = min_date
            else:
                candidate.meeting_display_date = max_date
            if count == 1:
                candidate.meeting_display_text = _('1 Meeting')
            elif candidate.meeting_display_date >= today:
                candidate.meeting_display_text = _('Next Meeting')
            else:
                candidate.meeting_display_text = _('Last Meeting')

Back to entity