英文:
Odoo 11 - Action Server
问题
以下是您的代码的翻译部分:
这是我的自定义动作声明的代码:
<record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
<field name="name">自动化操作...</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">天</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_ecole_partner_school"/>
<field name="code">model.run_grade_establishment_smartbambi()</field>
<field name="active" eval="False"/>
</record>
这是我调用的函数的开始部分:
这是我在服务器上更新自定义模块时收到的错误消息:
odoo.tools.convert.ParseError: "错误: 空值违反了列 'use_relational_model' 的 NOT NULL 约束
详情: 失败的行包含 (516559, 1, null, 1, 2020-01-02 14:56:39.02145, null, 2020-01-02 14:56:39.02145, ir.actions.server, 自动化操作..., null, action, model.run_grade_establishment_smartbambi(), 5, null, null, null, null, null, null, null, null, object_write, null, null, 397, null, null, null, null, null, null, null, null, null, null, null, null, f, null, null, ir_cron, null)"
解析 /opt/odoo11/addons-odoo/Odoo/ecole/data/actions.xml:33 时出错,靠近
<record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
<field name="name">自动化操作...</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">天</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_ecole_partner_school"/>
<field name="code">model.run_grade_establishment_smartbambi()</field>
<field name="active" eval="False"/>
</record>
您有关于问题的想法吗?我在互联网上找不到任何信息。
非常感谢您的帮助。
编辑:
我已解决我的问题。
在PGAdmin 4中,use_relational_model字段是必需的。我已停用了该字段的必需性。
谢谢
只提供了代码的翻译部分,没有包括问题和编辑的内容。如果需要更多信息,请告诉我。
英文:
Here is my code for a custom action declaration:
<record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
<field name="name">Action automatisee ...</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_ecole_partner_school"/>
<field name="code">model.run_grade_establishment_smartbambi()</field>
<field name="active" eval="False"/>
</record>
Here is the start of my function which is called:
Here is the error message when I update my custom module on the server:
odoo.tools.convert.ParseError: "ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « use_relational_model »
DETAIL: La ligne en échec contient (516559, 1, null, 1, 2020-01-02 14:56:39.02145, null, 2020-01-02 14:56:39.02145, ir.actions.server, Action automatisee ..., null, action, model.run_grade_establishment_smartbambi(), 5, null, null, null, null, null, null, null, null, object_write, null, null, 397, null, null, null, null, null, null, null, null, null, null, null, null, f, null, null, ir_cron, null)
" while parsing /opt/odoo11/addons-odoo/Odoo/ecole/data/actions.xml:33, near
<record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
<field name="name">Action automatisee ...</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_ecole_partner_school"/>
<field name="code">model.run_grade_establishment_smartbambi()</field>
<field name="active" eval="False"/>
</record>
Do you have an idea of the problem ? I can't find anything on the internet
thank you so much
EDIT :
I have solved my problem.
With PGAdmin 4, the use_relational_model field was required. I have deactivate the required.
Thanks
答案1
得分: 1
你在cron定义中漏掉了state
字段。这是“要执行的操作”字段。请尝试以下内容:
<record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
<field name="name">Action automatisée ...</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_ecole_partner_school"/>
<field name="state">code</field>
<field name="code">model.run_grade_establishment_smartbambi()</field>
<field name="active" eval="False"/>
</record>
英文:
You missed the state
field in the cron definition. This is the "Action To Do" field. Try following:
<record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
<field name="name">Action automatisee ...</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_ecole_partner_school"/>
<field name="state">code</field>
<field name="code">model.run_grade_establishment_smartbambi()</field>
<field name="active" eval="False"/>
</record>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论