Tags

, ,


.py file

class sale_line(osv.osv):
 _inherit="sale.order.line"
 def _getcost(self,cr,uid,ids,name,arg,context=None):
 res = {}
 for resource in self.browse(cr,uid,ids,context=context):
 res[resource.id]= resource.product_id.standard_price
 return res
 _columns ={
 'standard_price':fields.function(_getcost,'standard_price',type='char')
 }

.xml file

<record id="sale_view_order_line_form" model="ir.ui.view">
 <field name="name">Sale Order Line</field>
 <field name="model">sale.order</field>
 <field name="inherit_id" ref="sale.view_order_form" />
 <field name="arch" type="xml">
 <xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="after">
 <field name="standard_price" string="Cost"/>
 </xpath>
 </field>
 </record>
Advertisements