Inheritance Odoo-视图中的多级继承

Inheritance Odoo-视图中的多级继承,inheritance,view,odoo,odoo-11,Inheritance,View,Odoo,Odoo 11,我尝试使用多级继承的视图,但是子视图中的字段不显示在视图中。我目前在Odoo11社区版工作 详情如下: 试图为未来的向导提供一些基础模型。这就是模型的定义方式(始终使用inherit=进行模型间的继承): 因为我只想定义一次视图,所以我按照相同的方法为每个模型创建了一个表单视图:总是从“上面”继承。下面是(第一个)基本视图的定义,模型handleprocess.quick.action: handleprocess_qact_abstract_wz.form handleprocess.qu

我尝试使用多级继承的视图,但是子视图中的字段不显示在视图中。我目前在Odoo11社区版工作

详情如下:

试图为未来的向导提供一些基础模型。这就是模型的定义方式(始终使用inherit=进行模型间的继承):

因为我只想定义一次视图,所以我按照相同的方法为每个模型创建了一个表单视图:总是从“上面”继承。下面是(第一个)基本视图的定义,模型handleprocess.quick.action


handleprocess_qact_abstract_wz.form
handleprocess.quick.action
是否确实要执行此快速操作?
检查以确认您知道自己在做什么:
然后,接下来3个视图中的每一个都使用xpath从“上面”继承并添加自己的字段

这是第二个视图,modelhandleprocess.quick.action.update.file


handleprocess_qact_abstract_wz.form
handleprocess.quick.action
是否确实要执行此快速操作?
检查以确认您知道自己在做什么:
如果此时显示该模型的表单视图,则所有字段都会正确显示。字段在第二级继承之后消失,即在我定义此视图之后(对于modelhandleprocess.quick.action.update.file.integate):


手处理程序\u qact\u抽象\u ig\u wz.form
handleprocess.quick.action.update.file.Integrate
在向导的表单视图下面,也有同样的问题:没有显示任何字段

<record model="ir.ui.view" id="handleprocess_qact_ig_template_wz_form_view">
        <field name="name">handleprocess_qact_ig_template_wz.form</field>
        <field name="model">handleprocess.qact.ig.template.wz</field>
        <field name="inherit_id" ref="handleprocess_qact_abstract_ig_wz_form_view"/>
        <field name="priority">70</field>
        <field name="arch" type="xml">
            <xpath expr="//group[@id='security_check_group']/h6" position="before">
                <div>This Quick Action updates the template files in carrier boxes, in the environment specified below.</div>
            </xpath>
            <xpath expr="//field[@name='carrier_id']" position="after">
                <field name="template_file_id" options="{'no_create': True}" />
            </xpath>
        </field>
    </record>

handleprocess_qact_ig_模板_wz.form
handleprocess.qact.ig.template.wz
70
此快速操作将在下面指定的环境中更新载体盒中的模板文件。
请注意,我使用的是不同的模型,因为我需要根据字段将它们分开,因为一些其他向导计划在将来创建,并且并非所有的字段对于其他向导都是相同的(上面的向导定义只是第一个,应该会有更多)

打开向导(TransientModel)的操作定义如下,直接调用向导模型的表单视图:

<record model="ir.actions.act_window" id="handleprocess_qact_ig_template_wz_action">
        <field name="name">Update Template</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">handleprocess.qact.ig.template.wz</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="handleprocess.handleprocess_qact_ig_template_wz_form_view" />
        <field name="target">new</field>
    </record>

更新模板
ir.actions.act\u窗口
handleprocess.qact.ig.template.wz
形式
新的
我是否在视图定义中遗漏了什么


提前感谢。

需要将派生视图的
模式设置为
,因为它是该派生模型的基本(可能是唯一)视图。否则,规则将不适用

从观点来看:

模式

继承模式,请参阅。如果未设置
inherit\u id
,则
模式只能是
主模式
。如果设置了
inherit\u id
,默认情况下,
extension
,但可以显式地设置为
primary


一个示例是委派继承。在这种情况下,派生模型将与其父模型分离,与其中一个匹配的视图将与另一个不匹配。假设从与父模型关联的视图继承,并希望自定义派生视图以显示来自派生模型的数据。派生视图的
模式
需要设置为
主视图
,因为它是该派生模型的基础视图(可能是唯一的)。否则,规则将不适用


派生视图的
模式
需要设置为
主视图
,因为它是该派生模型的基本(可能是唯一)视图。否则,规则将不适用

从观点来看:

模式

继承模式,请参阅。如果未设置
inherit\u id
,则
模式只能是
主模式
。如果设置了
inherit\u id
,默认情况下,
extension
,但可以显式地设置为
primary


一个示例是委派继承。在这种情况下,派生模型将与其父模型分离,与其中一个匹配的视图将与另一个不匹配。假设从与父模型关联的视图继承,并希望自定义派生视图以显示来自派生模型的数据。派生视图的
模式
需要设置为
主视图
,因为它是该派生模型的基础视图(可能是唯一的)。否则,规则将不适用

<record model="ir.ui.view" id="handleprocess_qact_abstract_ig_wz_form_view">
        <field name="name">handleprocess_qact_abstract_ig_wz.form</field>
        <field name="model">handleprocess.quick.action.update.file.intergate</field>
        <field name="inherit_id" ref="handleprocess.handleprocess_qact_update_file_wz_form_view"/>
        <field name="arch" type="xml">
            <data>
                <xpath expr="//field[@name='create_backup']" position="before">
                    <field name="carrier_id" options="{'no_create': True}" />
                </xpath>
            </data>
        </field>
    </record>
<record model="ir.ui.view" id="handleprocess_qact_ig_template_wz_form_view">
        <field name="name">handleprocess_qact_ig_template_wz.form</field>
        <field name="model">handleprocess.qact.ig.template.wz</field>
        <field name="inherit_id" ref="handleprocess_qact_abstract_ig_wz_form_view"/>
        <field name="priority">70</field>
        <field name="arch" type="xml">
            <xpath expr="//group[@id='security_check_group']/h6" position="before">
                <div>This Quick Action updates the template files in carrier boxes, in the environment specified below.</div>
            </xpath>
            <xpath expr="//field[@name='carrier_id']" position="after">
                <field name="template_file_id" options="{'no_create': True}" />
            </xpath>
        </field>
    </record>
<record model="ir.actions.act_window" id="handleprocess_qact_ig_template_wz_action">
        <field name="name">Update Template</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">handleprocess.qact.ig.template.wz</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="handleprocess.handleprocess_qact_ig_template_wz_form_view" />
        <field name="target">new</field>
    </record>