title: How to get sale order field value in invoice from OpenERP
body: <p>I have created two custom fields in my sale order but these fields are not showing in the invoice form. I also add in invoice form view  and columns and update the server but this value is not showing in invoice.
  How can I show these values in the invoice form. Here is my view file:</p>
  
  <pre><code>&lt;record id="view_invoice_line_form" model="ir.ui.view"&gt;
          &lt;field name="name"&gt;account.invoice.line.form&lt;/field&gt;
          &lt;field name="model"&gt;account.invoice.line&lt;/field&gt;
          &lt;field name="arch" type="xml"&gt;
              &lt;form string="Invoice Line" version="7.0"&gt;
                  &lt;group&gt;
                      &lt;group&gt;
                          &lt;field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/&gt;
                          &lt;label for="quantity"/&gt;
                          &lt;div&gt;
                              &lt;field name="quantity" class="oe_inline"/&gt;
                              &lt;field name="uos_id" class="oe_inline" groups="product.group_uom"
                                on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/&gt;
                          &lt;/div&gt;
                          &lt;field name="purchase_order"/&gt;
                          &lt;field name="amt_total"/&gt; 
                          &lt;field name="price_unit"/&gt;
                          &lt;field name="discount" groups="sale.group_discount_per_so_line"/&gt;
                      &lt;/group&gt;
                      &lt;group&gt;
                          &lt;field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&amp;lt;&amp;gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)" groups="account.group_account_user"/&gt;
                          &lt;field name="invoice_line_tax_id" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]" widget="many2many_tags"/&gt;
                          &lt;field domain="[('type','&amp;lt;&amp;gt;','view'), ('company_id', '=', parent.company_id)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/&gt;
                          &lt;field name="company_id" groups="base.group_multi_company" readonly="1"/&gt;
                      &lt;/group&gt;
                  &lt;/group&gt;
                  &lt;label for="name"/&gt;
                  &lt;field name="name"/&gt;
              &lt;/form&gt;
          &lt;/field&gt;
      &lt;/record&gt;
  </code></pre>
  
  <p>And two fields added in .py file which are:    </p>
  
  <pre><code>'purchase_order':fields.many2one('purchase.order', 'Old Gold', ondelete="cascade"),
  'amt_total':fields.related('purchase_order', 'amount_total', type='float', relation='purchase.order', string="Amount", readonly=True),
  </code></pre>
  
  <p>and I created the function</p>
  
  <pre><code>def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
      cur_obj = self.pool.get('res.currency')
      res = {}
  
      for order in self.browse(cr, uid, ids, context=context):
  
  
          res[order.id] = {
              'amount_untaxed': 0.0,
              'amount_tax': 0.0,
              'amount_total': 0.0,
              'amt_total':0.0
          }
          val = val1 =  0.0
          cur = order.pricelist_id.currency_id
          for line in order.order_line:
              val1 += line.price_subtotal
  
              val += self._amount_line_tax(cr, uid, line, context=context)
          res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
          res[order.id]['amount_untaxed'] = cur_obj.round(cr, uid, cur, val1)
  
          res[order.id]['amount_untaxed'] -= order.amt_total
          res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']
      return res
  </code></pre>
  
  <p>Here I am able to subtract <code>amt_total</code> from the <code>total_amount</code> but in the invoice I can't subtract <code>amt_total</code> from the <code>total_amount</code>.</p>
  
  <p>When I perform the same action in the invoicing form it gives me an error:</p>
  
  <pre><code>ProgrammingError: column account_invoice_line.amt_total does not exist
  LINE 1: ...ne."partner_id",account_invoice_line."product_id",account_in...
  </code></pre>