0

在 Odoo 9 中,我试图继承采购订单表单视图(文件:addons/purchase/purchase_view.xml,记录:)<record id="purchase_order_form" model="ir.ui.view">。我需要做的是,只需编辑一个page标签的属性。我尝试使用 xpath 选择所需的页面,但它不能正常工作。

父视图结构

<notebook>
    <page string="Products">
        ......
        ......
        <notebook>
        <page string="Notes">
            <field name="name"/>
        </page><page string="Invoices and Incoming Shipments">
            <field name="invoice_lines"/>
            <field name="move_ids"/>
        </page>
        </notebook>
        ......
        ......
    </page>
    <page string="Deliveries &amp; Invoices">


    </page>
</notebook>

在我的视图文件中,我使用了以下代码来选择<page string="Deliveries &amp; Invoices">,这没有按预期工作。

<record model="ir.ui.view" id="purchase_order_type_form_view_inherit">
    <field name="name">purchase.order.form.inherit</field>
    <field name="model">purchase.order</field>
    <field name="inherit_id" ref="purchase.purchase_order_form"/>
    <field name="priority">10000</field>
    <field name="arch" type="xml">
        <xpath expr="//notebook/page[2]" position="attributes">
            <attribute name="groups">custom_module.manager</attribute>
        </xpath>
    </field>
</record>

提前致谢。

4

1 回答 1

1
<record model="ir.ui.view" id="purchase_order_type_form_view_inherit">
        <field name="name">purchase.order.form.inherit</field>
        <field name="model">hr_employee</field>
        <field name="inherit_id" ref="purchase.purchase_order_form"/>
        <field name="priority">10000</field>
        <field name="arch" type="xml">
            <xpath expr="//form/sheet/notebook/" position="after">
                <page>
                    <group>
                            <group colspan="4" col="4">

                                <label for="employment_ids" colspan="4" />
                                <field name="employment_ids" colspan="4" nolabel="1">
                                    <form string="Employee Employment">
                                        <field name="organization" />
                                        <field name="job_title" />
                                        <field name="entered_date" />
                                        <field name="resigned_date" />
                                        <field name="resigned_reason" />
                                        <field name="responsibility" />
                                        <field name="wage" />
                                    </form>
                                    <tree string="Employee Employment" editable="bottom">
                                        <field name="organization" />
                                        <field name="job_title" />
                                        <field name="entered_date" />
                                        <field name="resigned_date" />
                                        <field name="resigned_reason" />
                                        <field name="responsibility" />
                                        <field name="wage" />
                                    </tree>
                                </field>
                            </group>
                    </group>
                </page>
            </xpath>
        </field>
    </record>
于 2017-01-24T02:35:09.857 回答