0
votes

So I'm trying to remove a page on a form ("Tickets" from an event).

Since it has an attribute "name" I thought I could just remove it by doing:

<page name="registrations" position="replace"/>

But I kept getting the message that it couldn't locate that name in the parent view.

So I tried using an xpath expr:

<xpath expr="//form/sheet/notebook/page[1]" position="replace"/>

And keep getting the same error, how can I remove a page from a notebook then? This is version 10.

Complete XML:

    <record id="event_add_weeks" model="ir.ui.view">
        <field name="inherit_id" ref="event.view_event_form"/>
        <field name="model">event.event</field>
        <field name="arch" type="xml">
            <xpath expr="//page[@name='registrations']" position="replace"/>
        </field>
    </record>
2
Please update your question with whole trace-back error message.Bhavesh Odedra
The complete xml record would be nice, too. Without this i would say that both replaces look just fine.CZoellner
If using xpath this way (closing the tag right away) is not the problem, it could be that the page is not defined in the view. Let's say you have view1 that does not have a page. view2 inherits view1 to add a page. You try to remove page by inheriting view1 but you can't find the page there because view1 does not have a page. Solution : inherit view2 to delete the page.Majikat
@CZoellner added itRandomPerson
@Majikat I know how views work, this is not the case of wrong inheritance. This page does exist in the view in inheritingRandomPerson

2 Answers

1
votes

Try

<xpath expr="//page[@name='registrations']" position="attributes">
    <attribute name="invisible">1</attribute>
</xpath>

If not

<xpath expr="//page[@name='registrations']" position="replace">
</xpath>

Try this.

<xpath expr="//notebook" position="replace">
                       <page name="registrations" string="Registrations" invisible="1">
                            <group>
                                <group>
                                    <field name="seats_min"/>
                                    <label for="seats_availability"/>
                                    <div>
                                        <field name="seats_availability" widget='radio'/>
                                        <span  attrs="{'invisible': [('seats_availability', '=', 'unlimited')]}" class="oe_read_only">
                                            to
                                        </span>
                                        <field name="seats_max" attrs="{'invisible': [('seats_availability', '=', 'unlimited')], 'required': [('seats_availability', '=', 'limited')]}"/>
                                    </div>
                                </group>
                                <group>
                                    <field name="auto_confirm" groups="base.group_no_one"/>
                                </group>
                            </group>
                        </page>
                        <page string="Email Schedule">
                            <group>
                                <field name="reply_to"/>
                            </group>
                            <field name="event_mail_ids">
                                <tree string="Email Schedule" editable="bottom">
                                    <field name="sequence" widget="handle"/>
                                    <field name="template_id" />
                                    <field name="interval_nbr" attrs="{'readonly':[('interval_unit','=','now')]}"/>
                                    <field name="interval_unit"/>
                                    <field name="interval_type"/>
                                    <field name="done"/>
                                </tree>
                            </field>
                        </page>

</xpath>

You may need to make the html invisible so that other dependent views do not fail.

0
votes

I've looked into the origin view of Odoo 8 view_event_form. You just have a typo, it should be "Registrations". Following examples should work:

<page name="Registrations" position="replace" />

or

<xpath expr="//page[@name='Registrations']" position="replace" />