콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
8511 화면

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?



아바타
취소
베스트 답변

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.

아바타
취소
베스트 답변

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

아바타
취소