title: How to get a field of the parent form from a pop-up in Odoo?
body: <p>I have a form with a <em>One2many</em> field. From this field you can add elements, if you do this, a pop-up is opened. I would like to know how to get a field which was in the parent form in this pop-up.</p>
  
  <p>For example:</p>
  
  <p>The parent form (model <code>my.parent.model</code>) has a field named <code>partner_id</code>. The pop-up (model <code>my.child.model</code>) has a field named <code>product_id</code>. In <code>my.child.model</code> I added a function which is called when <code>product_id</code> changes (<code>@api.onchange('product_id')</code>). In this function I want to get the <code>partner_id</code> selected in the parent form.</p>
  
  <p>To do this, I added this to <code>product_id</code> in the XML view:</p>
  
  <pre><code>&lt;field name="product_id" context="{'partner_id':parent.partner_id}" /&gt;
  </code></pre>
  
  <p>In the onchange function, if there is not a selected partner, I raise an exception. When the pop-up is opened, this exception always raises, despite having a partner selected. But then, when I select any product, it works perfect.</p>
  
  <p>The problem is that the onchange function is triggered when the pop-up is opened, and in this case the context does not have the variable <code>partner_id</code> (as if it hadn't had enough time to get it).</p>
  
  <p>This problem did not happened in version 7, because in this version you had to pass variables to the onchange and you can include the <code>partner_id</code> there, but now, in version 8, how can I manage this?</p>
  
  <p>Thank you in advance!</p>