ir.cron: "错误:NULL 值违反了列 'model_id' 的 NOT NULL 约束
ir.cron: "ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « model_id »
我正在尝试在 odoo 12 中安装一个模块,其中包含 ir.cron 模块类型的视图。但它向我显示了这个错误:
我不知道如何纠正它。有谁能帮帮我吗?
odoo.tools.convert.ParseError: "ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « model_id »
DETAIL: La ligne en échec contient (434, Annuler la remise mensuelle du client, ir.actions.server, null, null, action, 1, 2019-03-13 14:48:25.710923, 1, 2019-03-13 14:48:25.710923, ir_cron, object_write, 5, null, null, # Available variables:
# - env: Odoo Environment on which the a..., null, null, null, null, null, null, null, days, specific, null, user_id)
" while parsing /home/*/PycharmProjects/Odoo12/*/sale_discount_total/views/cron.xml:5, near
<record model="ir.cron" id="deactivate_partner_discount_cron">
<field name="name">Annuler la remise mensuelle du client</field>
<field name="interval_number">1</field>
<field name="interval_type">months</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'res.partner'" name="model"/>
<field eval="'deactivate_partner_discount'" name="function"/>
<field eval="'()'" name="args"/>
</record>
问题出在第 <field eval="'res.partner'" name="model"/>
行,实际字段名称是 model_id
。您必须按以下方式设置字段
<field name="model_id" ref="model_res_partner"/>
由于 model_id
是 Many2one
与 ir.model
的关系,您可以将 ref
与模型 xml id 一起使用,对于 res.partner
模型 xml id 是 model_res_partner
.
ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « model_id »
粗略翻译,这个错误说:
ERROR: NULL value violates the NOT NULL constraint on the column model_id
如果您查看 ir.cron
记录的现有示例的核心代码,那么您将看到一个名为 model_id
的 XML 节点,这是创建cron 记录。
您正在使用:
<field eval="'res.partner'" name="model"/>
但在 Odoo 12 中,这是预期的:
<field name="model_id" ref="model_res_partner"/>
我在 Odoo 文档的任何地方都没有看到这个,所以我将 link 改为 some of the source code 以便您可以与您的记录进行比较。
我正在尝试在 odoo 12 中安装一个模块,其中包含 ir.cron 模块类型的视图。但它向我显示了这个错误:
我不知道如何纠正它。有谁能帮帮我吗?
odoo.tools.convert.ParseError: "ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « model_id »
DETAIL: La ligne en échec contient (434, Annuler la remise mensuelle du client, ir.actions.server, null, null, action, 1, 2019-03-13 14:48:25.710923, 1, 2019-03-13 14:48:25.710923, ir_cron, object_write, 5, null, null, # Available variables:
# - env: Odoo Environment on which the a..., null, null, null, null, null, null, null, days, specific, null, user_id)
" while parsing /home/*/PycharmProjects/Odoo12/*/sale_discount_total/views/cron.xml:5, near
<record model="ir.cron" id="deactivate_partner_discount_cron">
<field name="name">Annuler la remise mensuelle du client</field>
<field name="interval_number">1</field>
<field name="interval_type">months</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'res.partner'" name="model"/>
<field eval="'deactivate_partner_discount'" name="function"/>
<field eval="'()'" name="args"/>
</record>
问题出在第 <field eval="'res.partner'" name="model"/>
行,实际字段名称是 model_id
。您必须按以下方式设置字段
<field name="model_id" ref="model_res_partner"/>
由于 model_id
是 Many2one
与 ir.model
的关系,您可以将 ref
与模型 xml id 一起使用,对于 res.partner
模型 xml id 是 model_res_partner
.
ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « model_id »
粗略翻译,这个错误说:
ERROR: NULL value violates the NOT NULL constraint on the column
model_id
如果您查看 ir.cron
记录的现有示例的核心代码,那么您将看到一个名为 model_id
的 XML 节点,这是创建cron 记录。
您正在使用:
<field eval="'res.partner'" name="model"/>
但在 Odoo 12 中,这是预期的:
<field name="model_id" ref="model_res_partner"/>
我在 Odoo 文档的任何地方都没有看到这个,所以我将 link 改为 some of the source code 以便您可以与您的记录进行比较。