1 parent
2638b0cb77
commit
c074c26abc
6 files changed
+27
-10
No files matched your search
+4
-2
@@ -836,10 +836,12 @@
|
||||
this._current_domain = [];
|
||||
this.offset = 0;
|
||||
this.order = this.default_order = attributes.order;
|
||||
this.readonly = this.attributes.readonly || false;
|
||||
this.screen_readonly = this.attributes.readonly || false;
|
||||
var access = Sao.common.MODELACCESS.get(model_name);
|
||||
if (!(access.write || access.create)) {
|
||||
this.readonly = true;
|
||||
} else {
|
||||
this.readonly = this.screen_readonly;
|
||||
}
|
||||
this.search_count = 0;
|
||||
this.new_group(attributes.context || {});
|
||||
@@ -2015,7 +2017,7 @@
|
||||
get_buttons: function() {
|
||||
var selected_records = (
|
||||
this.current_view ? this.current_view.selected_records : []);
|
||||
if (jQuery.isEmptyObject(selected_records)) {
|
||||
if (jQuery.isEmptyObject(selected_records) || this.screen_readonly) {
|
||||
return [];
|
||||
}
|
||||
var buttons = (
|
||||
|
||||
@@ -130,9 +130,14 @@ function eval_pyson(value){
|
||||
}
|
||||
},
|
||||
_parse_button: function(node, attributes) {
|
||||
var button = new Sao.common.Button(attributes);
|
||||
button.el.click(button, this.view.button_clicked.bind(this.view));
|
||||
this.view.state_widgets.push(button);
|
||||
let button;
|
||||
if (this.view.screen.screen_readonly) {
|
||||
button = null;
|
||||
} else {
|
||||
button = new Sao.common.Button(attributes);
|
||||
button.el.click(button, this.view.button_clicked.bind(this.view));
|
||||
this.view.state_widgets.push(button);
|
||||
}
|
||||
this.container.add(button, attributes);
|
||||
},
|
||||
_parse_link: function(node, attributes) {
|
||||
|
||||
@@ -87,6 +87,9 @@
|
||||
}
|
||||
},
|
||||
_parse_button: function(node, attributes) {
|
||||
if (this.view.screen.screen_readonly) {
|
||||
return;
|
||||
}
|
||||
let button;
|
||||
if (parseInt(attributes.multiple || '0', 10)) {
|
||||
button = new Sao.View.Tree.ButtonMultiple(attributes);
|
||||
|
||||
@@ -49,10 +49,12 @@ class Screen:
|
||||
self.offset = 0
|
||||
self.windows = []
|
||||
|
||||
self.readonly = attributes.get('readonly', False)
|
||||
self.screen_readonly = attributes.get('readonly', False)
|
||||
if not (MODELACCESS[model_name]['write']
|
||||
or MODELACCESS[model_name]['create']):
|
||||
self.readonly = True
|
||||
else:
|
||||
self.readonly = self.screen_readonly
|
||||
self.search_count = 0
|
||||
if not attributes.get('row_activate'):
|
||||
self.row_activate = self.default_row_activate
|
||||
@@ -1245,7 +1247,7 @@ class Screen:
|
||||
states = record.expr_eval(button.attrs.get('states', {}))
|
||||
return not (states.get('invisible') or states.get('readonly'))
|
||||
|
||||
if not self.selected_records:
|
||||
if not self.selected_records or self.screen_readonly:
|
||||
return []
|
||||
|
||||
buttons = self.current_view.get_buttons() if self.current_view else []
|
||||
|
||||
@@ -261,9 +261,12 @@ class FormXMLViewParser(XMLViewParser):
|
||||
label.set_mnemonic_widget(widget.mnemonic_widget)
|
||||
|
||||
def _parse_button(self, node, attributes):
|
||||
button = Button(attributes)
|
||||
button.connect('clicked', self.view.button_clicked)
|
||||
self.view.state_widgets.append(button)
|
||||
if self.view.screen.screen_readonly:
|
||||
button = None
|
||||
else:
|
||||
button = Button(attributes)
|
||||
button.connect('clicked', self.view.button_clicked)
|
||||
self.view.state_widgets.append(button)
|
||||
self.container.add(button, attributes)
|
||||
|
||||
def _parse_link(self, node, attributes):
|
||||
|
||||
@@ -372,6 +372,8 @@ class TreeXMLViewParser(XMLViewParser):
|
||||
self.view.optionals[column.name].append(column)
|
||||
|
||||
def _parse_button(self, node, attributes):
|
||||
if self.view.screen.screen_readonly:
|
||||
return
|
||||
if int(attributes.get('multiple', 0)):
|
||||
button = ButtonMutiple(attributes)
|
||||
button.connect('clicked', self.view.button_clicked)
|
||||
|
||||
Reference in new issue
Block a user