Skip to Content
Menu
This question has been flagged
2 Replies
7904 Views

we need to add an custom action to the res.partner model in Edit/Detailview.


following code:


<record id="call_from_partner_action" model="ir.actions.server">
    <field name="name">Custom Export from Partner</field>
    <field name="model_id" ref="model_res_partner"/>
    <field name="state">code</field>
    <field name="code">action = model.cron_export_for_external()</field>
</record>

<record model="ir.values" id="demo_any_id">
    <field name="model_id"  ref="model_res_partner" />
    <field name="name">test</field>
    <field name="key2">client_action_multi</field>
    <field name="value"  eval="'ir.actions.server,' +str(ref('call_from_partner_action'))" />
    <field name="key">action</field>
    <field name="model">res.partner.model</field>
</record>


the second <record> leads to odoo.tools.convert.ParseError: "ir.values" while parsing ...

how should the record for ir.values be written in Odoo V12?



Avatar
Discard
Best Answer

You will get the above error because the ir.values model does not exist in Odoo 12. The ir.values model was removed and replaced with model ir.default.

Avatar
Discard
Best Answer

Server actions have a new way to specify bindings to a model. 

check this commit:

https://github.com/odoo/odoo/commit/55549f1e612793769fc7bdf860ac6af06735a755​

In your case change this entry:

<record id="call_from_partner_action" model="ir.actions.server">
    <field name="name">Custom Export from Partner</field>
    <field name="model_id" ref="model_res_partner"/>
    <field name="binding_model_id" ref="model_res_partner"/>
    <field name="state">code</field>
    <field name="code">action = model.cron_export_for_external()</field>
</record>

And delete the entry demo_any_id

Avatar
Discard