How to set dynamic message for confirm button
Currently, to add a confirmation, I will enter the message in the confirm attr of the button, so what if I want to display the confirmation through the function, so that I can vary the message how?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How to set dynamic message for confirm button
Currently, to add a confirmation, I will enter the message in the confirm attr of the button, so what if I want to display the confirmation through the function, so that I can vary the message how?
Hi,
If you are trying to make the display notification conditionally you can follow the below code:example
def action_confirm_button(self):
flag = 0
if your_conditio
flag = 1
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': "first message" if flag else
"second message",
'type': 'success' if flag else 'danger',
'sticky': False,
}
}
Or if you want to show different text in different times,You need to create a char field in your module and store the value in char fieldand the call the field value in messageeg:def action_confirm_button(self):
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': self.field_name,
'type': 'success',
'sticky': False,
}
}
Hope it helps
Sigh, can you please read the question. He/she asks for the CONFIRMATION message, not for a notification message to be shown.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
|
5
सित॰ 25
|
25129 | |||
|
3
अग॰ 25
|
3835 | |||
|
1
मई 25
|
3735 | |||
|
1
अप्रैल 25
|
4577 | |||
|
1
अप्रैल 25
|
5421 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
should have quote cybrosys