How to prevent buttons getting double clicked in Odoo?

Viewed 90

There are several occasions that users try to click a button multiple times in a row for whatever reason.

I want to disable or hide a button for a few seconds after it is clicked, so that it will not be clicked again temporarily.

By buttons here I mean every button in Odoo that is possible to implement this feature.

Is there a solution to achieve such mechanism?

If there is no system-wide implementation for this, a button-specific method will suffice.

1 Answers
    $(document).ready(function () {
         $("#yourbutton").on('click', function (event) {  
               event.preventDefault();
               //your js code
               //to disable the button:
               $(this).prop('disabled', true);
         });
    });
Related