Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
25951 Переглядів

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.

Аватар
Відмінити
Найкраща відповідь

hello follow this below link.

this will help you.

https://stackoverflow.com/questions/43983595/odoo-10-call-a-confirmation-form-yes-no-from-wizard

Аватар
Відмінити
Найкраща відповідь

 
 

This will helpful using button xml

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
лист. 17
9794
6
груд. 23
19966
3
бер. 17
3871
0
лют. 23
1830
1
квіт. 18
12949