跳至內容
選單
此問題已被標幟
2 回覆
25943 瀏覽次數

I know how to display confirm message on button click, like given below:

<button name="Name of the button"
    string="Showable label"
    type="object"
    confirm="Are you sure you want to do this?"
/>

But I want to achieve same functionality using python code.

Note: If we use `raise ValidationError('Error')` then it will terminate the execution, but I want to terminate execution only if the user click on cancel button which appear on dialog box else if click "OK" the it will simply continue execution like it happen if we add confirm attribute in button.

The code should be like this:

@api.multi
def write(self, vals):     statement 1
    statement 2
    if True:
        # Confirm dialog box will appear with the message whatever we include in it with ok and cancel button
    statement 3 # This statement will always execute unless the confirm dialog box appear and user click "Cancel" button.

頭像
捨棄
最佳答案

 
 

This will helpful using button xml

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
11月 17
9788
6
12月 23
19954
3
3月 17
3865
0
2月 23
1823
1
4月 18
12947