How to search for a record in the database?

  • language
  • type
  • info created for version
  • mvc
      Python (models/controllers)
Add to Cart

Suppose self is a project.task record and you want to fetch it's project ...

project_id = self.env['project.project'].browse(

If you don't know the id of a record to search for, you use the search method with a domain. For example ...

won_stage_ids = self.env['crm.stage'].search([('is_won', '=', True)])