xmlpython-3.xodooodoo-11

External ID not found in the system


I have a Odoo 10 cron xml, which looks like this:

    <record forcecreate="True" id="saas_portal_suspend_expired" model="ir.cron">
        <field name="name">Saas portal - suspend expired clients</field>
        <field eval="True" name="active" />
        <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">saas_portal.client</field>
        <field name="function">_cron_suspend_expired_clients</field>
        <field name="args">()</field>
    </record>

Which worked as should. I changed the code according to Odoo v11 to work, so it looks like this:

    <record forcecreate="True" id="saas_portal_suspend_expired" model="ir.cron">
        <field name="name">Saas portal - suspend expired clients</field>
        <field eval="True" name="active" />
        <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="saas_portal.client"/>
        <field name="function">_cron_suspend_expired_clients</field>
        <field name="args">()</field>
    </record>

As one can see I changed field model to model_id. But for some reason I'm getting error:

odoo.tools.convert.ParseError: "External ID not found in the system: saas_portal.client"

The module itself is called saas_portal, model I'm referencing has _name = 'saas_portal.client' I tried to use <field name="model_id" ref="saas_portal.saas_portal.client"/> but with no success. Is there anything I'm missing?


Solution

  • I don't know if this is changed between odoo version but when you reference a model you use this:

        addon_name.model_model_name # (.) --> (_)
    

    Ex:

        base.model_res_users
    

    In you case:

          ref="model_saas_portal_client"
     # or
     your_addon_name.model_saas_portal_client