Check if button is defined and use .prop()

This commit is contained in:
Guewen Baconnier
2016-01-11 12:02:39 +01:00
parent 36457bd54f
commit 38118ae32a

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);
}
}
}