title: How to save One2many fields values?
body: <p>I am adding custom <strong>One2many</strong> field in <strong>sale.order</strong> form view just below the <strong>sale.order.line</strong>.</p>
  
  <p>I am computing values <strong>on_change</strong> it is displaying values but when I am going to save the sales order it is generating error that </p>
  
  <blockquote>
    <p>ValueError: Wrong value for tax.lines.order_id: sale.order(24,)</p>
  </blockquote>
  
  <p><strong>Python:</strong></p>
  
  <pre><code>class SaleOrderInherit(models.Model):
  _inherit = ['sale.order']
  
  tax_line = fields.One2many('tax.lines', 'order_id', states={'cancel': [('readonly', True)], 'done': [('readonly', True)]}, copy=True, auto_join=True)
  
  @on.change('partner_id')
  def calculating_tax(self):
      //After some code
      self.env['tax.lines'].create({
                'tax_id': tax['tid'],
                'name': tax['name'],
                'amount': tax['tax'],
                'order_id': self.id
         })
  
  
  class TaxLines(models.Model):
  _name = 'tax.lines'
  
  tax_id = fields.Char('Tax Id')
  name = fields.Char('Tax Name')
  amount = fields.Char('Tax Amount')
  order_id = fields.Many2one('sale.order', string='Tax Report', ondelete='cascade', index=True, copy=False)
  </code></pre>
  
  <p>Because I am creating one2many field before creating the order.
  But is there any way to get rid of this problem.</p>
  
  <p>Edit:
  Error after replacing my code with <code>Charif DZ</code> code:</p>
  
  <p><a href="https://i.stack.imgur.com/4HnZ7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4HnZ7.png" alt="enter image description here"></a></p>