我正在使用 Odoo 11,我正在尝试向活动注册表单添加一个字段。注册表格实际上在网站上。
我可以添加到与会者表格,但这没有显示在网站注册表上。
型号
class EventRegistration(models.Model):
_inherit = "event.registration"
firstname = fields.Char(
string="Firstname",
index=True,
)
lastname = fields.Char(
string="Lastname",
index=True,
)
name = fields.Char(
string="Name",
compute="_compute_name",
readonly=True,
store=True
)
team = fields.Char(
string="Team",
store=True,
)
查看文件
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="view_event_registration_form_inherit_firstname">
<field name="name">event.registration.form</field>
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_event_registration_form" />
<field name="name">event.registration.view.form.inherit.firstname</field>
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="name" position="after">
<field name="firstname"/>
<field name="lastname"/>
<field name="team"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_event_registration_tree_inherit_firstname">
<field name="name">event.registration.tree</field>
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_event_registration_tree" />
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="name" position="after">
<field name="firstname"/>
<field name="lastname"/>
<field name="team"/>
</field>
<field name="partner_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_registration_search_inherit_firstname">
<field name="name">event.registration.search</field>
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_registration_search" />
<field name="arch" type="xml">
<xpath expr="//search/filter[last()]" position="after">
<field name="firstname" string="Firstname" filter_domain="[('firstname', 'ilike', self)]"/>
<field name="lastname" string="Lastname" filter_domain="[('lastname', 'ilike', self)]"/>
</xpath>
<xpath expr="//search/group" position="inside">
<filter string="Lastname" domain="[]" context="{'group_by': 'lastname'}"/>
<filter string="Firstname" domain="[]" context="{'group_by': 'firstname'}"/>
</xpath>
</field>
</record>
</odoo>
当我点击“立即注册”时,我想添加现场团队。正如您从图片中看到的,代码添加到了与会者页面。
要向活动注册表单添加字段,您必须继承模板“registration_attendee_details”。外部 ID 是
website_event.registration_attendee_details
。
您在哪里编辑此内容?或者您在哪里插入该代码?