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

I wanna add a server validation before change(or create) data, if not passed, create a confirm dialog to let user choose still save or not.

The problem is that I don't know how to create a confirm dialog when in write method, it is possible to make dialog by returning action when click button, but this not be able for write method.

So I try to raise server Error to manually call `new ActionManager().do_action()` in crash_manager.js, another problem came, I cannot get the form view object to reload it.

It really drives me crazy, please help me or share some experience if you have done some similar work.

อวตาร
ละทิ้ง

Please let me know if you find the solution, I am also having same problem

คำตอบที่ดีที่สุด

This will helpful

 
 

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

I've built a module to help for this case, please check it out:

https://apps.odoo.com/apps/modules/13.0/web_confirm_on_save


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

By using confirm tag in xml . You can do it . No need to write a method in python.


e.g.

  <button name="cancel_voucher" string="Cancel" type="object" states="posted" confirm="Are you sure you want to cancel this receipt?"/>

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

Actually, I need to do a validation before confirm dialog. I have done it with overwrite save button code.

Then you have to use python raise function in onchange method . So that you will get the validation before confirm message.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 24
6045
3
ส.ค. 24
6899
how to know the odoo master password? แก้ไขแล้ว
4
ก.ค. 24
41205
Default value in form view แก้ไขแล้ว
5
เม.ย. 23
98963
3
พ.ย. 22
4328