Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2128 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
delete the value of the taxes_id field แก้ไขแล้ว
1
ต.ค. 22
2805
2
ม.ค. 25
3208
1
มิ.ย. 25
1698
3
ก.ค. 25
3327
1
พ.ค. 25
1465