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

Module: Purchase Order security

Entity: purchase.order

Compute Method: _compute_team_id

Inputs Method Outputs
  • user_id
  • user_id.purchase_team_ids
"""When a user is assigned, the first team which the user belongs to is
        assigned, and if no one, the first purchase team.
        """
first_team = self.env["purchase.team"].search([], limit=1)
for record in self:
            record.team_id = record.user_id.purchase_team_ids[:1] or first_team

Back to entity