This question has been flagged
3 Replies
11245 Views

Iam try to add new fields to inherited custom module and hide a nother fields

1- I want remove "date_start" and "date_stop"

2- I want add "p_no"

this is my custom view code but it is not work :

<record model="ir.ui.view" id="custom_mrp_bom_tree_view">
                <field name="name">mrp.bom.tree.inherit</field>
                <field name="model">mrp.bom</field>
                <field name="type">tree</field>
                <field name="inherit_id" ref="mrp.mrp_bom_tree_view"/>
                <field name="arch" type="xml">
                    <tree string="BoM Structure">
                    <field name="date_start" position="replace"/>
                    <field name="date_stop" position="replace" />
                    <field name="routing_id" position="after">
                        <field name="p_no" />
                    </field>
                    </tree>   
                </field>
        </record>

Avatar
Discard
Best Answer

I use to hide some fields:

<xpath expr="//field[@name='field_name']" position="replace"></xpath>

and for add news fields: 

<xpath expr="//field[@name='field_name']" position="after">
      <field name="new_field"/>
</xpath>

Avatar
Discard
Best Answer

Source record with id = "mrp.mrp_bom_tree_view" has model "mrp.bom.line". In your custom view model = "mrp.bom", this is wrong!

Avatar
Discard
Best Answer

Just in case; read this from Ray Carnes

http://ursainfosystems.com/homesite/upgrade-safe-changes-to-odoo-views/

Avatar
Discard