从笔记本中移除页面

时间:2017-02-13 13:35:08

标签: openerp odoo-10

所以我试图删除表单上的页面(事件中的“Tickets”)。

由于它有一个属性“name”,我以为我可以通过执行以下操作删除它:

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

但我不断收到消息,说它无法在父视图中找到该名称。

所以我尝试使用xpath expr:

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

并且不断出现同样的错误,如何从笔记本中删除页面呢?这是版本10.

完整的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 个答案:

答案 0 :(得分:1)

尝试

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

如果不是

<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>

试试这个。

//Form Start

void MainFormLoad(object sender, EventArgs e)
{

    Control.ControlCollection locais =  groupBoxLocalização.Controls;

        foreach (CheckBox chkBox in locais)
        {
            chkBox.MouseUp += chkBoxLocais_MouseUp;
        }
}

// Event
void chkBoxLocais_MouseUp(object sender, MouseEventArgs e)
{

    //Tratar individualmente
    CheckBox chk = (CheckBox)sender;

    //ou para tratar todos objetos de uma vez

    Control.ControlCollection locais =  groupBoxLocalização.Controls;
    foreach (CheckBox chkBox in locais) {
        //chkBox....
    }

}

您可能需要使html不可见,以便其他相关视图不会失败。

答案 1 :(得分:0)

我已经查看了Odoo 8 view_event_form的原点视图。你只有一个错字,它应该是&#34; R egistrations&#34;。以下示例应该有效:

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

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