大神:我在odoo12中进行website_form白名单设置时(准备能过前端网页写数据),按书中往ir.model中插入记录,并设置字段”website_form_access"为True和"website_form_label"字段:
<odoo>
<data>
<record id="bm_website.model_bug" model="ir.model">
<field name="website_form_access">True</field>
<field name="website_form_label">创建Bug</field>
</record>
<function model="ir.model.fields"
name="formbuilder_whitelist">
<value>bm.bug</value>
<value eval="[
'name'
'user_id'
'deadline'
]"/>
</function>
<!--菜单设置-->
<record id="menu_bug" model="website.menu">
<field name="name">Bug</field>
<field name="url">/bugs</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">50</field>
</record>
</data>
</odoo>
在模块升级时,就报错:
odoo.tools.convert.ParseError: "错误: 在字段 "name" 中空值违反了非空约束
DETAIL: 失败, 行包含(333, null, x_, null, manual, f, 1, 2020-03-17 05:14:41.06213, 1, 2020-03-17 05:14:41.06213, f, t, null, 创建Bug).
" while parsing file:/d:/odoo/odoo12/myaddons/bm_website/data/config_data.xml:32, near
<record id="bm_website.model_todo_task" model="ir.model">
<field name="website_form_access">True</field>
<field name="website_form_label">创建Bug</field>
</record>*
尝试给“name”字段赋值,加上
<field name="name">website_form_config</field>
后,又报错:
odoo.tools.convert.ParseError: "model" while parsing file:/d:/odoo/odoo12/myaddons/bm_website/data/config_data.xml:3, near
<record id="bm_website.model_bug" model="ir.model">
<field name="name">website_form_config</field>
<field name="website_form_access">True</field>
<field name="website_form_label">创建Bug</field>
</record>
请大神帮看看,谢谢