0
点赞
收藏
分享

微信扫一扫

odoo12—开发手册>>P08

目标践行者 2022-05-02 阅读 41
python

odoo实操5

xml视图☞视图继承

<record id="oa_form2" model="ir.ui.view">
    <field name="name">基础表单</field>
    <field name="model">oa</field>
    <field name="inherit_id" ref="oa_form"/>
    <field name="arch" type="xml">
        <xpath expr="//sheet" position="after">
            <button type="action" class="pull-right btn-primary"
                    style="position: absolute; margin-right: 0px; background-color: #875a7b; right: 16px;"
                    string="流程单 :" icon="fa-flag">
                <field name="oa_applicant" readonly="1"
                       style="padding-right: 10px;padding-left: 5px;font-size: initial;"/>
                <field name="oa_state" readonly="1"/>
            </button>
        </xpath>
    </field>
</record>

标签和创建的时是一样的,添加一个继承键值对,ref的值为你要继承的视图

<field name="inherit_id" ref="oa_form"/>

同样在此标签下写添加的部分:

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

xpath标签开头,expr值为定位到视图的某个标签,position值为 after、inside、before、attributes,表示在此标签的后、里、前,attributes却是可以在此标签内添加其他属性,比如添加js:

<xpath expr="//form" position="attributes">
     <attribute name="js_class">tree_form_view_button</attribute>
</xpath>
举报

相关推荐

0 条评论