Odoo 11 – Action Server

huangapple go评论113阅读模式
英文:

Odoo 11 - Action Server

问题

以下是您的代码的翻译部分:

  1. 这是我的自定义动作声明的代码:
  2. <record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
  3. <field name="name">自动化操作...</field>
  4. <field name="user_id" ref="base.user_root"/>
  5. <field name="interval_number">1</field>
  6. <field name="interval_type"></field>
  7. <field name="numbercall">-1</field>
  8. <field name="doall" eval="False"/>
  9. <field name="model_id" ref="model_ecole_partner_school"/>
  10. <field name="code">model.run_grade_establishment_smartbambi()</field>
  11. <field name="active" eval="False"/>
  12. </record>
  13. 这是我调用的函数的开始部分:
  14. 这是我在服务器上更新自定义模块时收到的错误消息:
  15. odoo.tools.convert.ParseError: "错误: 空值违反了列 'use_relational_model' 的 NOT NULL 约束
  16. 详情: 失败的行包含 (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)"
  17. 解析 /opt/odoo11/addons-odoo/Odoo/ecole/data/actions.xml:33 时出错,靠近
  18. <record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
  19. <field name="name">自动化操作...</field>
  20. <field name="user_id" ref="base.user_root"/>
  21. <field name="interval_number">1</field>
  22. <field name="interval_type"></field>
  23. <field name="numbercall">-1</field>
  24. <field name="doall" eval="False"/>
  25. <field name="model_id" ref="model_ecole_partner_school"/>
  26. <field name="code">model.run_grade_establishment_smartbambi()</field>
  27. <field name="active" eval="False"/>
  28. </record>
  29. 您有关于问题的想法吗?我在互联网上找不到任何信息。
  30. 非常感谢您的帮助。
  31. 编辑:
  32. 我已解决我的问题。
  33. PGAdmin 4中,use_relational_model字段是必需的。我已停用了该字段的必需性。
  34. 谢谢

只提供了代码的翻译部分,没有包括问题和编辑的内容。如果需要更多信息,请告诉我。

英文:

Here is my code for a custom action declaration:

  1. &lt;record id=&quot;scheduler_synchronization_update_school_and_grade&quot; model=&quot;ir.cron&quot;&gt;
  2. &lt;field name=&quot;name&quot;&gt;Action automatisee ...&lt;/field&gt;
  3. &lt;field name=&quot;user_id&quot; ref=&quot;base.user_root&quot;/&gt;
  4. &lt;field name=&quot;interval_number&quot;&gt;1&lt;/field&gt;
  5. &lt;field name=&quot;interval_type&quot;&gt;days&lt;/field&gt;
  6. &lt;field name=&quot;numbercall&quot;&gt;-1&lt;/field&gt;
  7. &lt;field name=&quot;doall&quot; eval=&quot;False&quot;/&gt;
  8. &lt;field name=&quot;model_id&quot; ref=&quot;model_ecole_partner_school&quot;/&gt;
  9. &lt;field name=&quot;code&quot;&gt;model.run_grade_establishment_smartbambi()&lt;/field&gt;
  10. &lt;field name=&quot;active&quot; eval=&quot;False&quot;/&gt;
  11. &lt;/record&gt;

Here is the start of my function which is called:

Odoo 11 – Action Server

Here is the error message when I update my custom module on the server:

  1. odoo.tools.convert.ParseError: &quot;ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne &#171; use_relational_model &#187;
  2. DETAIL: La ligne en &#233;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)
  3. &quot; while parsing /opt/odoo11/addons-odoo/Odoo/ecole/data/actions.xml:33, near
  4. &lt;record id=&quot;scheduler_synchronization_update_school_and_grade&quot; model=&quot;ir.cron&quot;&gt;
  5. &lt;field name=&quot;name&quot;&gt;Action automatisee ...&lt;/field&gt;
  6. &lt;field name=&quot;user_id&quot; ref=&quot;base.user_root&quot;/&gt;
  7. &lt;field name=&quot;interval_number&quot;&gt;1&lt;/field&gt;
  8. &lt;field name=&quot;interval_type&quot;&gt;days&lt;/field&gt;
  9. &lt;field name=&quot;numbercall&quot;&gt;-1&lt;/field&gt;
  10. &lt;field name=&quot;doall&quot; eval=&quot;False&quot;/&gt;
  11. &lt;field name=&quot;model_id&quot; ref=&quot;model_ecole_partner_school&quot;/&gt;
  12. &lt;field name=&quot;code&quot;&gt;model.run_grade_establishment_smartbambi()&lt;/field&gt;
  13. &lt;field name=&quot;active&quot; eval=&quot;False&quot;/&gt;
  14. &lt;/record&gt;

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字段。这是“要执行的操作”字段。请尝试以下内容:

  1. <record id="scheduler_synchronization_update_school_and_grade" model="ir.cron">
  2. <field name="name">Action automatisée ...</field>
  3. <field name="user_id" ref="base.user_root"/>
  4. <field name="interval_number">1</field>
  5. <field name="interval_type">days</field>
  6. <field name="numbercall">-1</field>
  7. <field name="doall" eval="False"/>
  8. <field name="model_id" ref="model_ecole_partner_school"/>
  9. <field name="state">code</field>
  10. <field name="code">model.run_grade_establishment_smartbambi()</field>
  11. <field name="active" eval="False"/>
  12. </record>
英文:

You missed the state field in the cron definition. This is the "Action To Do" field. Try following:

  1. &lt;record id=&quot;scheduler_synchronization_update_school_and_grade&quot; model=&quot;ir.cron&quot;&gt;
  2. &lt;field name=&quot;name&quot;&gt;Action automatisee ...&lt;/field&gt;
  3. &lt;field name=&quot;user_id&quot; ref=&quot;base.user_root&quot;/&gt;
  4. &lt;field name=&quot;interval_number&quot;&gt;1&lt;/field&gt;
  5. &lt;field name=&quot;interval_type&quot;&gt;days&lt;/field&gt;
  6. &lt;field name=&quot;numbercall&quot;&gt;-1&lt;/field&gt;
  7. &lt;field name=&quot;doall&quot; eval=&quot;False&quot;/&gt;
  8. &lt;field name=&quot;model_id&quot; ref=&quot;model_ecole_partner_school&quot;/&gt;
  9. &lt;field name=&quot;state&quot;&gt;code&lt;/field&gt;
  10. &lt;field name=&quot;code&quot;&gt;model.run_grade_establishment_smartbambi()&lt;/field&gt;
  11. &lt;field name=&quot;active&quot; eval=&quot;False&quot;/&gt;
  12. &lt;/record&gt;

huangapple
  • 本文由 发表于 2020年1月6日 15:47:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608406.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定