| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 26 |
| Technical Name |
dynamic_confirmation_message |
| License | LGPL-3 |
Dynamic Confirmation Message
Generate confirmation dialogs on the fly with server-side logic.
Why this module?
Odoo already lets you define static confirmation texts via confirm="message" in <button> tag.
This module upgrades that behavior by letting you pass a Python method name directly via
confirm_method="method_name". When the user clicks the button, the method runs,
returning a message that reflects the current record state. The dialog always shows relevant
guidance without maintaining dozens of XML variants.
Key capabilities
- Works on any button that already supports the
confirmattribute. - Re-computes the confirmation text every time the button is pressed.
- Fallbacks if the Python method returns an empty string (no dialog shown).
- Errors are reported to the user through the standard notification service.
How to configure
- Create or reuse a button in XML.
- Set
confirm_method="your_python_method"in<button>tag to specify the method to call. - Implement
your_python_methodon the model. It must return a string representing the confirmation message. Returning an empty string skips the dialog.
Example use cases
- Warn users about outstanding tasks right before validating a document.
- Display contextual totals or dates inside the confirmation pop-up.
- Block the action if server-side checks fail by raising an exception.
Please log in to comment on this module