title: how to automatically fill a One2many
body: <p>I am currently using the native module of odoo [Sales] -sales orders and I want to pass the registration of a One2many field at the moment of pressing the button that redirects me to another new formula that I have created and has a field One2Mnay.</p>
  
  <p>example:
      this is the native module of odo where I am registering my sales orders:
  <a href="https://i.stack.imgur.com/wvcyq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wvcyq.png" alt="enter image description here"></a></p>
  
  <p>I have created a new botton that is red says [registrar cotizacion] , 
  called method: [open_budget] which allows to open a new form that I created and has a field one2many :</p>
  
  <p>My models :</p>
  
  <p>Models of new form :</p>
  
  <pre><code>class BudgetTwo(models.Model):
      _name = 'budget.two'
      name = fields.Char(string ='Nombre', copy=False, index=True ,default ="Nuevo")
      partner_id =fields.Many2one('res.partner' ,string ='Cliente', copy=False, index=True,required=True)
      deliver_date = fields.Date(string ='Fecha de Entrega')
      expiration_date = fields.Date(string ='Fecha de expiración')
      pay_place =fields.Many2one('account.payment.term' ,string='Plazo de Pago')
      order_line = fields.One2many('budget.table','budget_id' ,string = 'Pedidos' )
      total = fields.Float(string = 'Total:' ,compute="_total")
      btn_d = fields.Boolean(default = False)
  </code></pre>
  
  <p>Inheritance of the odoo's own module:</p>
  
  <pre><code>class InheritOrder(models.Model):
      _inherit = 'sale.order'
      @api.multi
      def open_budget(self):
          if self.order_line:
              for element in self.order_line:
                  data = element.product_id.id
          else:print('none')
          print(data)
  
          return {
              'name': ('Payments'),
              'view_type': 'form',
              'view_mode': 'form',
              'res_model': 'budget.two',
              'view_id': False,
              'type': 'ir.actions.act_window',
              'context': {
                  'default_partner_id': self.partner_id.id,
                  'default_order_line.product_id': data,
                  'default_order_line.product_id': data,
              },
          }
  </code></pre>
  
  <p>the native module of odoo has a field One2many that are the orders, when I press the new botton loogre redirect to the new form that I created and created a dictionary which has a key called context I can pass the records that I have in the fields but the record that I have in the one2many values ​​are not passed.</p>
  
  <p>Finally :</p>
  
  <pre><code>'context': {
                  'default_partner_id': self.partner_id.id,
                  'default_order_line.product_id': data,
                  'default_order_line.product_id': data,
              },
  </code></pre>
  
  <p>desauld_pernert_id if the record passes but default_order_line.product_id does not pass the record that is the on2many, as you can see:</p>
  
  <p><a href="https://i.stack.imgur.com/UJWia.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UJWia.png" alt="enter image description here"></a></p>