How to disable a button after clicking on it in OpenERP

This may be a simple question. But does anyone know how to disable a button after clicking on it in OpenERP? Please help !!!!! Thanks for your help....

+4
source share
3 answers

There are two ways to hide the displayed button.

  • Change the state of the object and the display button based on statistics.

eg

<button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/> 

This is an example of account.invoice , where the Approve button will be visible if invoice is in draft or proforma2 .

  • You can add group for viewing, and the button will be displayed only for this groups .

eg

 <field name="account_id" groups="account.group_account_user"/> 

This is an example account.invoice.line , where the account_id field is shown only to users who belong to account.group_account_user .

Hope this solves your problem.

+4
source

If we are talking about the web interface, you can disable it using javascript.

0
source

If you are talking about a web interface, yes, this is possible with Javascript.

 $('button').click(function(){$(this).prop('disabled', true);}); 
-2
source

Source: https://habr.com/ru/post/1400979/


All Articles