Odoo 11 – Action Server

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

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:

        &lt;record id=&quot;scheduler_synchronization_update_school_and_grade&quot; model=&quot;ir.cron&quot;&gt;
&lt;field name=&quot;name&quot;&gt;Action automatisee ...&lt;/field&gt;
&lt;field name=&quot;user_id&quot; ref=&quot;base.user_root&quot;/&gt;
&lt;field name=&quot;interval_number&quot;&gt;1&lt;/field&gt;
&lt;field name=&quot;interval_type&quot;&gt;days&lt;/field&gt;
&lt;field name=&quot;numbercall&quot;&gt;-1&lt;/field&gt;
&lt;field name=&quot;doall&quot; eval=&quot;False&quot;/&gt;
&lt;field name=&quot;model_id&quot; ref=&quot;model_ecole_partner_school&quot;/&gt;
&lt;field name=&quot;code&quot;&gt;model.run_grade_establishment_smartbambi()&lt;/field&gt;
&lt;field name=&quot;active&quot; eval=&quot;False&quot;/&gt;
&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:

odoo.tools.convert.ParseError: &quot;ERREUR:  une valeur NULL viole la contrainte NOT NULL de la colonne &#171; use_relational_model &#187;
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)
&quot; while parsing /opt/odoo11/addons-odoo/Odoo/ecole/data/actions.xml:33, near
&lt;record id=&quot;scheduler_synchronization_update_school_and_grade&quot; model=&quot;ir.cron&quot;&gt;
&lt;field name=&quot;name&quot;&gt;Action automatisee ...&lt;/field&gt;
&lt;field name=&quot;user_id&quot; ref=&quot;base.user_root&quot;/&gt;
&lt;field name=&quot;interval_number&quot;&gt;1&lt;/field&gt;
&lt;field name=&quot;interval_type&quot;&gt;days&lt;/field&gt;
&lt;field name=&quot;numbercall&quot;&gt;-1&lt;/field&gt;
&lt;field name=&quot;doall&quot; eval=&quot;False&quot;/&gt;
&lt;field name=&quot;model_id&quot; ref=&quot;model_ecole_partner_school&quot;/&gt;
&lt;field name=&quot;code&quot;&gt;model.run_grade_establishment_smartbambi()&lt;/field&gt;
&lt;field name=&quot;active&quot; eval=&quot;False&quot;/&gt;
&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字段。这是“要执行的操作”字段。请尝试以下内容:

<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:

    &lt;record id=&quot;scheduler_synchronization_update_school_and_grade&quot; model=&quot;ir.cron&quot;&gt;
&lt;field name=&quot;name&quot;&gt;Action automatisee ...&lt;/field&gt;
&lt;field name=&quot;user_id&quot; ref=&quot;base.user_root&quot;/&gt;
&lt;field name=&quot;interval_number&quot;&gt;1&lt;/field&gt;
&lt;field name=&quot;interval_type&quot;&gt;days&lt;/field&gt;
&lt;field name=&quot;numbercall&quot;&gt;-1&lt;/field&gt;
&lt;field name=&quot;doall&quot; eval=&quot;False&quot;/&gt;
&lt;field name=&quot;model_id&quot; ref=&quot;model_ecole_partner_school&quot;/&gt;
&lt;field name=&quot;state&quot;&gt;code&lt;/field&gt;
&lt;field name=&quot;code&quot;&gt;model.run_grade_establishment_smartbambi()&lt;/field&gt;
&lt;field name=&quot;active&quot; eval=&quot;False&quot;/&gt;
&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:

确定