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

Module: Sales Teams

Entity: crm.team

Compute Method: _compute_member_warning

Inputs Method Outputs
""" Display a warning message to warn user they are about to archive
        other memberships. Only valid in mono-membership mode and take into
        account only active memberships as we may keep several archived
        memberships. """
self.member_warning = False
if all(team.is_membership_multi for team in self):
            return
for team in self:
            other_memberships = self.env['crm.team.member'].search([
                ('crm_team_id', '!=', team._origin.id if team.ids else False),
                ('user_id', 'in', team.member_ids.ids)
            ])
            if other_memberships:
                team.member_warning = _("%(user_names)s already in other teams (%(team_names)s).",
                                   user_names=", ".join(other_memberships.mapped('user_id.name')),
                                   team_names=", ".join(other_memberships.mapped('crm_team_id.name'))
                                  )

Back to entity