تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2049 أدوات العرض

how to call a server action from a function?

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أكتوبر 22
2775
2
يناير 25
3104
1
يونيو 25
1545
3
يوليو 25
3216
1
مايو 25
1365