Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2068 Zobrazení

how to call a server action from a function?

Avatar
Zrušit
Nejlepší odpověď

Hi,

We can use the following code for creating a server action.

<record id="model_test_record_id" model="ir.actions.server">


            <field name="name">Record Name</field>


            <field name="model_id" ref="module_name.model_model_name"/>


            <field name="binding_model_id" ref="module_name.model_model_name"/>


            <field name="binding_view_types">form</field>


            <field name="state">code</field>


            <field name="code">action = records.demo_server_action()</field>


 </record>


We can define the server action demo_server_action() on the model.name model

Use the following code to call the server action from a function.

@api.model
def function_name(self):
model_id.demo_server_action()

Regards

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
říj 22
2777
2
led 25
3131
1
čvn 25
1590
3
čvc 25
3239
1
kvě 25
1384