我想在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>
数据继承工作正常。我有我想在继承视图中看到的所有字段。问题是,它没有设置继承视图的样式。对于主视图,所有内容都显示在“工作表”环境中,但对于继承的视图,顺序是另一个,工作表不显示。“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'
提前致谢。