<commit_before>
from odoo import api, fields, models


class HrEmployee(models.Model):
    _inherit = 'hr.employee'

    last_resume_line_ids = fields.One2many(
        'hr.resume.line', 'employee_id', string="Last resumé lines",
        compute="_compute_last_resume_lines", store=True
    )

    @api.depends('resume_line_ids')
    def _compute_last_resume_lines(self):
        for record in self:
            line_channels = record.resume_line_ids.mapped('channel_id')
            unique_last_resume_line_ids = []
            for channel in line_channels:
                unique_last_resume_line = max(record.resume_line_ids.filtered(
                    lambda r: r.channel_id == channel),
                    key=lambda x: x.date_end)
                unique_last_resume_line_ids.append(unique_last_resume_line.id)

            record.last_resume_line_ids = record.resume_line_ids.filtered(
                lambda r: r.id in unique_last_resume_line_ids
            )
<commit_msg>[FIX] hr_employee_resume_line: Fix no channel assigned resume lines view on employee (#123)<commit_after>
from odoo import fields, models


class HrEmployee(models.Model):
    _inherit = 'hr.employee'

    last_resume_line_ids = fields.One2many(
        'hr.resume.line', 'employee_id', string="Last resumé lines",
        compute="_compute_last_resume_lines",
    )

    def _compute_last_resume_lines(self):
        for record in self:
            line_channels = record.resume_line_ids.mapped('channel_id')
            unique_last_resume_line_ids = record.resume_line_ids.filtered(
                lambda r: r.channel_id == False).ids
            for channel in line_channels:
                unique_last_resume_line = max(record.resume_line_ids.filtered(
                    lambda r: r.channel_id == channel),
                    key=lambda x: x.date_end)
                unique_last_resume_line_ids.append(unique_last_resume_line.id)

            record.last_resume_line_ids = record.resume_line_ids.filtered(
                lambda r: r.id in unique_last_resume_line_ids
            )

{'fraction_non_alphanumeric': 0.08144578313253012, 'fraction_numerical': 0.0024096385542168677, 'mean_word_length': 2.5731497418244405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1681702', 'n_tokens_mistral': 641, 'n_tokens_neox': 633, 'n_words': 115}