I want to hide the edit button when a invoice\' state is paid, just like the image below.
You can do this by overriding load_record
of FormView
widget:
openerp.module_name = function(instance, local) {
var instance = openerp;
var FormView = instance.web.FormView;
// override load_record
FormView.include({
load_record: function(record) {
// disable only for purchase.order
if (record){
// allow this behavior only for purchase.order
if (this.model == 'purchase.order' & _.contains(['done', 'cancel'], record.state)){
$('button.oe_form_button_edit').hide()
}else {
$('button.oe_form_button_edit').show()
}
}
// call super
return this._super(record);
}
});
}
Check this app
if you looking for full code:
Disable edit button for paid invoice