Odoo继承视图未设置样式

Odoo Inherited view not styled

我想在 Odoo v8 中继承一个视图。第一个视图的 ID:form_authority_information 继承视图的 ID: form_authority_information_construction_law

这是 form_authority_information

的代码
<record model="ir.ui.view" id="form_authority_information">
        <field name="name">view.name</field>
        <field name="model">company.authority_information</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <group colspan="4" id="content">
                        <group colspan="2" col="2" id="general">
                            <separator string="General" colspan="2"/>
                            <field name="related_field"/>
                            <field name="information_date"/>
                            <field name="information_medium" attrs="{'invisible':[('is_finished', '=', True)]}" />
                            <field name="is_finished"/>
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

对于form_authority_information_construction_law:

<record model="ir.ui.view" id="form_authority_information_construction_law">
        <field name="name">Construction Law</field>
        <field name="model">company.authority_information.construction_law</field>
        <field name="inherit_id" ref="form_authority_information"/>
        <field name="arch" type="xml">
            <data>
                <group id="general" position="after">
                    <separator string="Construction Law" colspan="2"/>
                    <field name="construction_law_type"/>
                    <field name="building_area_type"/>
                    <field name="zoning_name" attrs="{'invisible':[('construction_law_type', '=', 'qualified')]}"/>

                </group>
            </data>
        </field>
    </record>

数据继承工作正常。我有我想在继承视图中看到的所有字段。问题是,它没有为继承的视图设置样式。对于主视图,所有内容都显示在 "sheet" 环境中,但对于继承视图,顺序是另一个,并且不显示 sheet。 "attr" 属性 也不起作用。

有人知道这种奇怪行为的解决方案吗?

更新:图片 更新 2:是否需要外部 ID 才能正常工作?

更新 3:Python 代码 models.py

class company_authority_information(models.Model):
    _name = 'company.authority_information'
    # other fields...

class company_authority_information_report_committee(models.Model):
    _name = 'company.authority_information.report_committee'
    _inherit = 'company.authority_information'

提前致谢。

尝试关注,

class company_authority_information(models.Model):
    _name = 'company.authority_information'
    # other fields...

class gut8_authority_information_report_committee(models.Model):
    _inherit = 'company.authority_information'

如果您提供 _name,那么它将为此创建 table,因此当您继承任何模型时,您要么保持与 _inherit 相同的 _name,要么不指定 _name,以防那里存在 _inherit。重启服务器,如果不行就升级模块。

<record model="ir.ui.view" id="form_authority_information_construction_law">
        <field name="name">Construction Law</field>
        <field name="model">company.authority_information</field>
        <field name="priority" eval="50" />
        <field name="inherit_id" ref="form_authority_information"/>
        <field name="arch" type="xml">
                <group id="general" position="after">
                    <separator string="Construction Law" colspan="2"/>
                    <field name="construction_law_type"/>
                    <field name="building_area_type"/>
                    <field name="zoning_name" attrs="{'invisible':[('construction_law_type', '=', 'qualified')]}"/>
                </group>
        </field>
    </record>