,根据要求,需要定制插入CRM.lead模型(CRM模块-Odoo 11)的“联系我们”表单。 我需要在此模型中添加其他字段。 问题!已经在此模型中添加了新字段,但现在显示在表单视图中。
<record id="crm_case_form_view_leads_inherited" model="ir.ui.view">
<field name="name">crm.lead.form.lead.inherited</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
<field name="arch" type="xml">
<notebook position="inside">
<page string="Extra fields">
<group>
<field name="field_x"/>
<field name="field_y"/>
<field name="field_z"/>
</group>
</page>
</notebook>
</field>
class Lead(models.Model):
_inherit = 'crm.lead'
field_x = fields.Char(string='Field X)
field_y = fields.Text(string='Field Y')
field_z = fields.Char(string='Field Z')
问题未在表单视图上显示字段值。
检查显示为问题的此链接: https://drive.google.com/file/d/1ZoqU2REHlpwJm_oQ7mXJmNJSqF8v22KA/view
答案 0 :(得分:0)
<record id="crm_case_form_view_leads_inherited" model="ir.ui.view">
<field name="name">crm.lead.form.lead.inherited</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor" />
<field name="arch" type="xml">
<xpath expr="//page[@name='lead']" position="after">
<page string="Extra fields">
<group>
<field name="field_x"/>
<field name="field_y"/>
<field name="field_z"/>
</group>
</page>
</xpath>
</field>