继承视图和添加字段
inheritance view and adding fields
我有候选模型继承了hr.emplyee模型
我想显示 hr.employee 的表单视图并添加我的子模型候选人
的字段
class hr_candidat(models.Model):
_name='hr_recrutement.candidat'
_inherit='hr.employee'
_description="Informations du Candidats"
situation=fields.Selection(string="Situation",selection=[('Nouveau','Nouveau'),('RDV Thechnique','RDV Technique'),('Annulation','Annulationn')])
。
.
.
<record id="hr_recrutement_candidat_form" model="ir.ui.view">
<field name="name">Candidat</field>
<field name="model">hr_recrutement.candidat</field>
<field name="arch" type="xml">
<form string="Candidat">
<sheet>
<group>
<field name="situation" />
.
.
</group>
</sheet>
</form>
</field>
</record>
我不知道如何在视图中显示 hr.employee + 我的候选人字段
只是我们应该从视图 xml 文件中设置下面的代码,并且
在你的 openerp.py 中添加依赖的 模块作为 hr 并设置视图 xml 文件路径。
在您的 .py 文件中添加以下代码
class hr_employee(models.Model):
_inherit='hr.employee'
_description="Informations du Candidats"
situation=fields.Selection(string="Situation",selection=[('Nouveau','Nouveau'),('RDV Thechnique','RDV Technique'),('Annulation','Annulationn')])
在您的 .xml 文件中添加以下代码
<record id="hr_recrutement_caindidat_form" model="ir.ui.view">
<field name="name">Candidat</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="arch" type="xml">
<xpath expr="field[@name='work_location']" position="after">
<field name="situation" />
</xpath>
</field>
</record>
听说我们必须根据 xpath 使用 xpath 标记的 before,after,inside,replace
Attributes 设置元素的位置。
希望我的回答对您有所帮助:)
我有候选模型继承了hr.emplyee模型 我想显示 hr.employee 的表单视图并添加我的子模型候选人
的字段class hr_candidat(models.Model):
_name='hr_recrutement.candidat'
_inherit='hr.employee'
_description="Informations du Candidats"
situation=fields.Selection(string="Situation",selection=[('Nouveau','Nouveau'),('RDV Thechnique','RDV Technique'),('Annulation','Annulationn')])
。 . .
<record id="hr_recrutement_candidat_form" model="ir.ui.view">
<field name="name">Candidat</field>
<field name="model">hr_recrutement.candidat</field>
<field name="arch" type="xml">
<form string="Candidat">
<sheet>
<group>
<field name="situation" />
.
.
</group>
</sheet>
</form>
</field>
</record>
我不知道如何在视图中显示 hr.employee + 我的候选人字段
只是我们应该从视图 xml 文件中设置下面的代码,并且 在你的 openerp.py 中添加依赖的 模块作为 hr 并设置视图 xml 文件路径。
在您的 .py 文件中添加以下代码
class hr_employee(models.Model):
_inherit='hr.employee'
_description="Informations du Candidats"
situation=fields.Selection(string="Situation",selection=[('Nouveau','Nouveau'),('RDV Thechnique','RDV Technique'),('Annulation','Annulationn')])
在您的 .xml 文件中添加以下代码
<record id="hr_recrutement_caindidat_form" model="ir.ui.view">
<field name="name">Candidat</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="arch" type="xml">
<xpath expr="field[@name='work_location']" position="after">
<field name="situation" />
</xpath>
</field>
</record>
听说我们必须根据 xpath 使用 xpath 标记的 before,after,inside,replace
Attributes 设置元素的位置。
希望我的回答对您有所帮助:)