I've created a module to add a new field "Shipment Cost" in the purchase order form after "unit price" field. It works successfully, but I cannot update the "subtotal" field value accordingly. the value of "Subtotal" should be (("unit price" x "Quantity") + "Shipment Cost"). Can anybody please help me? The code of the module is as below:
File 1: purchase_shipment.py
from openerp.osv import fields, osv from openerp import netsvc
class purchase_order_line(osv.osv): _name = 'purchase.order.line' _inherit = "purchase.order.line" _columns = { 'shipment_cost': fields.float('Shipment Cost', size=30, store=True), } purchase_order_line()
File 2: purchase_shipment_view.xml
<openerp> <data> <record model="ir.ui.view" id="view_purchase_form1"> <field name="name">purchase.order.form.inherit</field> <field name="model">purchase.order</field> <field name="inherit_id" ref="purchase.purchase_order_form"/> <field name="arch" type="xml"> <xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="after"> <field name="shipment_cost"/> </xpath> </field> </record> </data> </openerp>
hello you are found any solution related this problem ??