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

Hi!

How to handling multi actions in odoo 17, e.g. when I clicking the "confirm" button in a form view it should do:

1. confirm form 

2. print the invoice

3. redirect to tree view

regards


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Raoufsirat


You can handle multiple actions on a button click by creating a custom method and binding it to the button. Here’s a general idea of how you can achieve this:

​1.Confirm Form: This is usually handled by the built-in workflow of the form view. If you have a custom workflow, you can add the necessary code in your method.

​2.Print the Invoice: You can call the report action in your method. Here’s an example of how to do this:

report = self.env.ref('module_name.report_id')
return report.report_action(self)

​3.Redirect to Tree View: You can return an action that opens the desired tree view. Here’s an example:

return {
    'type': 'ir.actions.act_window',
    'name': 'Action Name',
    'res_model': 'model.name',
    'view_mode': 'tree,form',
    'target': 'current',
}

You can combine all these actions in a single method and bind it to the “Confirm” button.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 25
606
0
ส.ค. 25
344
0
ก.ค. 25
1403
0
ก.ค. 25
3
0
ก.ค. 25
6