I have two related fields in question, x_nk_categ_id and x_nk_class_desc. For some reason field "x_nk_class_desc" is returning empty rows. I have checked in the table mrp_bom, field x_nk_categ_id is correctly populated with categ_id values, but column x_nk_class_desc is empty.
class mrp_bom(osv.osv):
_inherit = 'mrp.bom'
_name = 'mrp.bom'
_columns = {
'x_nk_default_code': fields.related('product_id',
'default_code', type='char', relation='product.product',
string='Part Number', store=True, readonly=True),
'x_nk_categ_id': fields.related('product_id', 'categ_id',
type='many2one', relation='product.product',
string='Product Category', store=True, readonly=True),
'x_nk_class_desc': fields.related('x_nk_categ_id', 'name',
type='char', relation='product.category', string='Class
Description', store=True, readonly=True),
'x_nk_item_desc': fields.related('product_tmpl_id', 'name',
type='char', relation='product.template', string='Item
Description', store=True, readonly=True),
}
Here is my XML code:
<record id="adamson_mrp_bom_tree_view_2" model="ir.ui.view">
<field name="name">adamson.mrp.bom.tree.view.2</field>
<field name="model">mrp.bom</field>
<field name="type">tree</field>
<field name="inherit_id"
ref="adamson_systems_engineering.adamson_mrp_bom_tree_view" />
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='product_id']" position="replace">
<field name="x_nk_default_code" />
<field name="x_nk_class_desc" />
<field name="x_nk_item_desc" />
</xpath>
</field>
</record>
Here is how empty Class Description looks in view:
