-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
web_access_rule_buttons.js
44 lines (36 loc) · 1.03 KB
/
web_access_rule_buttons.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* © 2016 Camptocamp SA
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
*/
odoo.define('web_access_rule_buttons.main', function (require) {
"use strict";
var core = require('web.core');
var FormView = require('web.FormView');
var ListView = require('web.ListView');
FormView.include({
load_record: function() {
var self = this;
return this._super.apply(this, arguments)
.then(function() {
self.show_hide_buttons()
});
},
show_hide_buttons: function() {
var self = this;
this.dataset.call('check_access_rule_all',
[[this.datarecord.id],
['write']])
.then(function(accesses) {
self.show_hide_edit_button(accesses.write);
});
},
show_hide_edit_button: function(access) {
if (this.$buttons) {
var button = this.$buttons.find('.oe_form_button_edit');
if(button) {
button.prop('disabled', !access);
}
}
}
});
});