I'm attempting to display the customer reference as a read only field in the Delivery orders form view.
I added a related field to the stock.picking.out model:
class stock_picking_out(osv.Model):
_inherit = "stock.picking.out"
_columns = {
'cust_order_ref': fields.related('sale_id', 'client_order_ref', type='char', string='Customer Reference'),
}
I inherited the delivery order view with the following block:
<record id="view_stock_picking_out_extended_form" model="ir.ui.view">
<field name="name">stock.picking.out.extended.form</field>
<field name="model">stock.picking.out</field>
<field name="inherit_id" ref="stock.view_picking_out_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='origin']" position="after">
<field name="client_order_ref" />
</xpath>
</field>
</record>
When I install my custom module, I do see the model getting updated with the new field, and I also see the new field appear in the delivery order view. However, the values of this field are always empty, even if there is a customer order reference in the related sale order (sale_id). Can anyone explain to me what I am doing wrong here?
Thanks in advance.