title: Retrieve partner_id in onchange() function Odoo 10
body: <p>I want to retrieve "id" actually partner. 
  With my function, I use <code>onchange()</code> decorator but, for it to work, I have to put the hard value. </p>
  
  <p>I have tried: </p>
  
  <pre><code>print self.partner_id.id
  print self.partner_id
  </code></pre>
  
  <p>It sends me :</p>
  
  <pre><code>&lt;odoo.models.NewId object at 0x7fa382596090&gt;
  res.partner(&lt;odoo.models.NewId object at 0x7fa382596090&gt;
  </code></pre>
  
  <p>Here my function : </p>
  
  <pre><code># Récupère le foyer actif
  @api.onchange('foyer_members')
  def _get_active_foyer(self):
      for record in self:
          if record.foyer_members:
              print self.partner_id.id
              print self.partner_id
              records_foyer_id = self.env['horanet.relation.foyer'].search([('partner_id', '=', 145536)], limit=1)
              print records_foyer_id
  </code></pre>
  
  <p>My fields : </p>
  
  <pre><code>partner_id = fields.Many2one(string="Child", comodel_name="res.partner")
  
  foyer_members = fields.Many2one(string='Foyers members',
                                  comodel_name="res.partner",
                                  ondelete='restrict',
                                  domain="[('company_type','=','foyer')]",
                                  delegate=False)
  </code></pre>
  
  <p>How to do it? Thank You!</p>