title: Odoo: How to use context to pass value from model to one2many field
body: <p>I want to pass the value of a many2one field to a one2many field in order to filter results of the latter, i am trying to use context but i don't know if i'm using it correctly or not</p>
  
  <p>The idea is that i want to filter products (part of the one2many field) based on the chosen branch (the many2one field)</p>
  
  <p>my code is as below</p>
  
  <pre><code>class CustomTransRequest(models.Model):
      _name = 'custom.trans.request'
  
      branch_from_id = fields.Many2one('custom.branch', string="From", required=True)
      branch_to_id = fields.Many2one('custom.branch', string="To", required=True)
      product_ids = fields.One2many(comodel_name="custom.trans.line", inverse_name="request_id", string="Products", required=False, )
  
  class CustomTransLine(models.Model):
      _name = 'custom.trans.line'
  
      request_id = fields.Many2one("custom.trans.request", string="Request ID", required=True, )
      product_id = fields.Many2one("custom.product", string="Product", required=True)
      qty = fields.Integer(string="Qty", required=True)
  
  class CustomProduct(models.Model):
      _name = 'custom.product'
  
      product_name = fields.Char(string="Name", required=False, )
      branch_line = fields.One2many('custom.branch.line', 'product_id', string='Branch', )
  
  class CustomBranchLine(models.Model):
      _name = 'custom.branch.line'
  
      branch_id = fields.Many2one('custom.branch', string='Branch', ondelete='cascade')
      product_id = fields.Many2one('custom.product', string='Product', required=True, )
      qty = fields.Integer(string="QTY", required=True, )
  </code></pre>
  
  <pre><code>&lt;record id="form_custom_trans_request" model="ir.ui.view"&gt;
          &lt;field name="name"&gt;custom.trans.request.form&lt;/field&gt;
          &lt;field name="model"&gt;custom.trans.request&lt;/field&gt;
          &lt;field name="arch" type="xml"&gt;
              &lt;form string="Transfer Request"&gt;
                  &lt;sheet&gt;
                      &lt;group&gt;
                          &lt;field name="branch_from_id"/&gt;
                          &lt;field name="branch_to_id"/&gt;
                      &lt;/group&gt;
                      &lt;notebook&gt;
                          &lt;page string="Products" name="order_lines"&gt;
                              &lt;field name="product_ids" context="{'default_branch_id':branch_from_id}" mode="tree"&gt;
                                  &lt;tree editable="bottom"&gt;
                                      &lt;control&gt;
                                          &lt;create string="Open list view"/&gt;
                                      &lt;/control&gt;
                                      &lt;field name="product_id" domain="[('branch_line.branch_id','=',default_branch_id)]" /&gt;
                                      &lt;field name="qty"/&gt;
                                  &lt;/tree&gt;
                              &lt;/field&gt;
                          &lt;/page&gt;
                      &lt;/notebook&gt;
                  &lt;/sheet&gt;
              &lt;/form&gt;
          &lt;/field&gt;
      &lt;/record&gt;
  </code></pre>