I has a moudle that inherit stock.packing and also has a custom field name cw_inventory_ref.
if I write my code like this,
<xpath expr="//field[@name='partner_id']" position="after">
<field name="cw_inventory_ref"/>
</xpath>
the cw_inventory_ref is appeared after parent_id.
I don't want like this.
I want cw_inventory_ref to appeared in front of parent_id.
for example, [data of cw_inventory_ref]data of parent_id.
So, I write my code as following but it doesn't work,
in xml file:
<record id="cw_stock_picking_tree_view" model="ir.ui.view">
<field name="name">cw_stock_picking_tree_view</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree"></field>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="replace">
[<field name="cw_inventory_ref"/>]<field name="partner_id"/>
</xpath>
</field>
</record>
In .py file:
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class cw_update(models.Model):
_inherit = 'stock.picking'
cw_inventory_ref = fields.Char(string=' Internal Reference ',related = "partner_id.ref",readonly=True)
How can I fix this?Thank you.
Why don't you use position="before" ??
If I used before and after, I will show one line per data.
I want to shown like this [partner_ref]partner in position of partner_id.