Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2562 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 3 17
7991
4
thg 5 23
9833
1
thg 1 19
8998
0
thg 10 17
3123
0
thg 11 16
2441