Función oculta: ☑️ CONFIRMAR antes de click | MENSAJE de CONFIRMACIÓN |Truco XML programación Odoo
How to Add a Confirmation Dialog Before Cancelling a Quotation
Introduction to the Problem
- The speaker introduces a trick for displaying a confirmation dialog before cancelling a quotation in the sales module, addressing the lack of user prompts when using the standard cancel button.
Implementing the Confirmation Dialog
- The current functionality does not ask users if they are sure about cancelling; it simply cancels. The goal is to prompt users with a confirmation message.
- The speaker demonstrates how to activate this feature by identifying the button (action cancel) where the dialog will be implemented.
Steps to Add Confirmation
- In edit mode, locate the action cancel button and add code:
confirm = "Are you sure you want to continue?"This sets up the text for the confirmation dialog.
- After saving changes, refreshing allows testing of the new functionality. A dialog appears asking for confirmation with options for Yes or No.
Testing and Expanding Functionality
- The speaker shows how to replicate this functionality on another button (action Draft), ensuring consistency across different actions.
- By changing text and repeating similar steps, users can customize dialogs as needed, demonstrating ease of implementation.