This question has been flagged
1 Reply
1953 Views

I've inherited a form view and made some modifications using xpath. I need a button in the header of form view to show only to admin user. But when I'm putting the groups, its giving following error :

Error details:

 Element '<button name="action_done" states="draft,assigned,confirmed" string="Process Entirely" type="object" class="oe_highlight" groups="base.group_no_one">' cannot be located in parent view

My code is:


<record id="wms_stock_view_move_form" model="ir.ui.view">

            <field name="name">wms.stock.view.move.form</field>

            <field name="model">stock.move</field>

            <field name="inherit_id" ref="stock.view_move_form" />

            <field name="arch" type="xml">

                <field name="location_id" position="attributes">

                    <attribute name="domain">[('name','!=', 'Scrapped')]</attribute>

                </field>

                <field name="location_dest_id" position="attributes">

                    <attribute name="domain">[('name','!=', 'Scrapped')]</attribute>

                </field>

                <xpath expr='//form[@string="Stock Moves"]' position='attributes'>

                    <attribute name="create">false</attribute>

                    <attribute name="edit">false</attribute>

                    <attribute name="delete">false</attribute>

                </xpath>

                <xpath expr='//button[@name="action_cancel"]' position='attributes'>

                    <attribute name="invisible">True</attribute>

                </xpath>

                <button name="action_done" states="draft,assigned,confirmed" string="Process Entirely" type="object" class="oe_highlight" position="replace" groups="base.group_no_one"/>

            </field>

        </record>


Thanks a lot in advance

Avatar
Discard
Best Answer

when you use inherit, system expects a xpath or any tag with a position attribute.

On your case you are doing almost everything ok, except this part:

<button name="action_done" states="draft,assigned,confirmed" string="Process Entirely" type="object" class="oe_highlight" position="replace" groups="base.group_no_one"/>

System is looking for a tag with all those attibutes, and there isn't.

Your code must be:


<button name="action_done" position="replace">
<button name="action_done" states="draft,assigned,confirmed" string="Process Entirely" type="object" class="oe_highlight" position="replace" groups="base.group_no_one"/>
</button>


Or in any case Xpath.

Avatar
Discard