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

Hello,

I need to call a wizard from Create method, I searched a lot on the web and I found that is impossible the achieve that.  My purpose is to check if a condition is true or not before creating a new record and if this condition is true a wizard will be called. Otherwise, the record will be created normally.

The pseudo-code is like below :

@api.model

def create(self, vals)

if condition:

    return wizard

else:

   return super(model_name, self).create(vals)

Any help please ?

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



This is not simple in normal ways !!
You can bring the fields of wizard into form. Then remove wizard.

Otherwise you can use the odoo's way...

  •  Create states like Draft, confirmed etc..

  • Add 'Confirm' button  in draft state.

  • Display Confirmation wizard on button click

  • Move to 'Confirmed' if confirmation is positive. Else keep in draft.

  • Delete draft records manually if you need.

Thanks !!

iWesabe

อวตาร
ละทิ้ง
ผู้เขียน

Thank you very much for your response. But my wizard doesn't have any field, it just displays a confirmation dialog box, can you help please?

I have updated my answer.

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ธ.ค. 21
7382
1
ม.ค. 19
6569
2
พ.ย. 17
6041
0
พ.ค. 21
2837
2
พ.ย. 24
14234