I would like to add the "ship" field to the sale order lines as a drop down list (many2one field).
My xml file ship_view.xml:
<record model="ir.ui.view" id="ship_orderline">
<field name="model">sale.order.line</field>
<field name="name">sale.form</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="before">
<field name="ship"/>
</xpath>
</field>
</record>
Try this belowing code. Check out that the model should be sale.order
in the view:
Python code
from openerp import models, fields
class CustomSaleOrderLine(models.Model):
_inherit = 'sale.order.line'
ship = fields.Char(
string='Ship',
)
XML view
<record model="ir.ui.view" id="ship_orderline">
<field name="model">sale.order</field>
<field name="name">sale.order.form</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree//field[@name='product_uom_qty']" position="before">
<field name="ship"/>
</xpath>
</field>
</record>