title: How to copy value of one field to another in odoo?
body: <p>I have created a custom field discount in product.template module, now i want to copy and assign it to discount field in sales module. I want to automate discount once  I type its name,price and its discount value in invoice.I am creating products from create and edit option in invoice. If i generate invoice for the same product again once i select the product its discount should be automatically applied.I tried with one of the code which I got from Internet it automated discount but product description and price value vanished.
  discount is a field in sales module,x_discount is a field in products module, I want to copy x_discount value to discount ,as they are in different modules I am finding it difficult.</p>
  
  <pre><code>dis = self.pool.get('product.template').browse(cr, uid,product,context=context).x_discount
  return  {'value': {'discount':dis}}
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/T1Pzn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T1Pzn.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/oAdQl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oAdQl.png" alt="enter image description here"></a></p>