Check if button is defined and use .prop()

This commit is contained in:
Guewen Baconnier
2016-01-11 12:02:39 +01:00
committed by antonio
parent 836a642c42
commit f44ddacb88

View File

@@ -33,10 +33,8 @@ odoo.define('web_access_rule_buttons.main', function (require) {
show_hide_edit_button: function(access) {
if (this.$buttons) {
var button = this.$buttons.find('.oe_form_button_edit');
if(access) {
button.removeAttr('disabled');
} else {
button.attr('disabled', true);
if(button) {
button.prop('disabled', !access);
}
}
}