title: odoo domain search "id in ids"
body: <p>I have a model B with a Many2many field referencing model A.
  Now given an id of model A, I try to get the records of B that reference it.</p>
  
  <p>Is this possible with Odoo search domains? Is it possible doing some SQL query?</p>
  
  <p><strong>Example</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>class A(models.Model):
      _name='module.a'
  
  class B(models.Model):
      _name='module.b'
      a_ids = fields.Many2many('m.a')
  </code></pre>
  
  <p>I try to do something like</p>
  
  <pre class="lang-py prettyprint-override"><code>a_id = 5
  filtered_b_ids = self.env['module.b'].search([(a_id,'in','a_ids')])
  </code></pre>
  
  <p>However, this is not a valid search in Odoo. Is there a way to let the database do the search?
  So far I fetch all records of B from the database and filter them afterward:</p>
  
  <pre class="lang-py prettyprint-override"><code>all_b_ids = self.env['module.b'].search([])
  filtered_b_ids = [b_id for b_id in b_ids if a_id in b_id.a_ids]
  </code></pre>
  
  <p>However, I want to avoid fetching not needed records and would like to let the database do the filtering.</p>