I would like to know the way to hide the "edit" button from the form view when it is in a specific state
for example: In the help desk I have the stage_id, I want the edit button to be completely hidden from all people when it goes to "closed" state
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I would like to know the way to hide the "edit" button from the form view when it is in a specific state
for example: In the help desk I have the stage_id, I want the edit button to be completely hidden from all people when it goes to "closed" state
Hi,
You can use JS to achieve this.
First you need to extend Form view.
var FormView = require('web.FormView');
var FormController = require('web.FormController');
Then using renderButtons function, you can find
renderButtons: function() {
this._super.apply(this, arguments);
if (this.$buttons) {
var button = this.$buttons.find('button.o_form_button_edit');
}
}
Now you have the button. Next, you need to check the condition and hide the button. For that
renderButtons: function() {
this._super.apply(this, arguments);
if (this.$buttons) {
if(this.initialSate.data.state == 'closed'){
this.$buttons.find('button.o_form_button_edit').hide();
}
}
}
Regards
Try this...
https://www.odoo.com/forum/help-1/record-rule-doesnt-remove-form-edit-button-179790#answer-179823
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
2
feb 23
|
1817 | ||
|
2
sept 15
|
5455 | ||
|
1
mar 15
|
3623 | ||
|
3
may 24
|
3029 | ||
|
1
nov 22
|
3208 |