Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3374 Переглядів

I'm creating an Automated Action with several Actions that need to be run sequentially. This is what I'm doing at the moment:

<odoo>
<data noupdate="0">
<record id="donation_customer_invoice" model="ir.filters">
<field name="name">Donation Customer Invoice</field>
<field name="model_id">account.invoice</field>
<field name="domain">[('type','=','out_invoice'),('x_invoice_sub_type','=','donation'),('state','=','draft')]</field>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="create_donation_supplier_invoice" model="ir.actions.server">
<field name="name">Create Donation Supplier Invoice</field>
<field name="model_id">175</field>
<field name="sequence">1</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="code">env['autoaction.supplier'].create_donation_supplier_invoice(object)</field>
</record>
<record id="create_cf_commission_supplier_invoice" model="ir.actions.server">
<field name="name">Create CF Commission Supplier Invoice</field>
<field name="model_id">175</field>
<field name="sequence">2</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="code">env['autoaction.supplier'].create_cf_commission_supplier_invoice(object)</field>
</record>
<record id="donation_customer_invoice_action" model="base.action.rule">
<field name="name">Donation Supplier Invoices Action</field>
<field name="model_id">175</field>
<field name="sequence">1</field>
<field name="active">1</field>
<field name="kind">on_write</field>
<field name="server_action_ids" eval="[(6,0,[ref('create_donation_supplier_invoice')])]"/>
</record>
</data>
</odoo>

As you can see I have 2 ir.actions.server in this case, which I want to pass to base.action.rule at the bottom. I can pass 1 of them by doing:

<field name="server_action_ids" eval="[(6,0,[ref('donation_customer_server_action')])]"/>

but I'm not sure how to add more than 1, I've tried:

 <field name="server_action_ids" eval="[(6,0,[ref('create_donation_supplier_invoice'), ref('create_cf_commission_supplier_invoice')])]"/>

which gave me a parse error, I've also tried few other variants such as:

 <field name="server_action_ids" eval="[(6,0,[ref('create_donation_supplier_invoice')]),(6,0,[ref('create_cf_commission_supplier_invoice')])]"/>

which works but instead of adding both actions, it adds the last one and only the last one.

How can I pass more than 1 action to server_action_ids?

Also, in regards to model_id, I'm harding the id in but can you reference it automatically? The model in question would acount.invoice



Аватар
Відмінити
Автор

I've tried

<field name="server_action_ids" eval="[(6,0,[ref('create_donation_supplier_invoice'), ref('create_cf_commission_supplier_invoice')])]"/>

again, since I saw this syntax being used elsewhere and now it works!

Related Posts Відповіді Переглядів Дія
2
жовт. 23
6500
2
лист. 22
6880
2
січ. 22
1803
0
вер. 21
2992
0
черв. 21
2922