Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
6635 Weergaven

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

Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
feb. 23
1976
2
sep. 15
5601
1
mrt. 15
3758
3
mei 24
3310
1
nov. 22
3391