diff --git a/sao/src/window.js b/sao/src/window.js
index d7e1d81dbd..dfd869f345 100644
--- a/sao/src/window.js
+++ b/sao/src/window.js
@@ -179,8 +179,7 @@
}
});
- var readonly = (this.screen.attributes.readonly ||
- this.screen.group.readonly);
+ var readonly = this.screen.readonly || this.screen.group.readonly;
this.but_ok = null;
this.but_new = null;
@@ -223,7 +222,7 @@
}));
}
- if (this.save_current) {
+ if (this.save_current && !readonly) {
this.but_ok = jQuery('', {
'class': 'btn btn-primary',
'type': 'submit',
@@ -396,7 +395,7 @@
var name = '_';
var access = Sao.common.MODELACCESS.get(this.screen.model_name);
var deletable = this.screen.deletable;
- var readonly = this.screen.group.readonly || this.screen.readonly;
+ var readonly = this.screen.readonly || this.screen.group.readonly;
if (position >= 1) {
name = position;
if (this.domain) {
@@ -486,7 +485,7 @@
response: function(response_id) {
var result;
this.screen.current_view.set_value();
- var readonly = this.screen.group.readonly;
+ var readonly = this.screen.readonly || this.screen.group.readonly;
if (~['RESPONSE_OK', 'RESPONSE_ACCEPT'].indexOf(response_id) &&
!readonly &&
this.screen.current_record) {
diff --git a/tryton/tryton/gui/window/win_form.py b/tryton/tryton/gui/window/win_form.py
index 4a8cfa64e2..4217c2eadf 100644
--- a/tryton/tryton/gui/window/win_form.py
+++ b/tryton/tryton/gui/window/win_form.py
@@ -101,7 +101,7 @@ class WinForm(NoModal, InfoBar):
self.but_new.set_always_show_image(True)
self.but_new.set_accel_path('/Form/New', self.accel_group)
- if self.save_current:
+ if self.save_current and not readonly:
self.but_ok = Gtk.Button(label=_('_Save'), use_underline=True)
self.but_ok.set_image(common.IconFactory.get_image(
'tryton-save', Gtk.IconSize.BUTTON))
@@ -353,7 +353,7 @@ class WinForm(NoModal, InfoBar):
deletable = True
if self.screen.current_record:
deletable = self.screen.current_record.deletable
- readonly = self.screen.group.readonly
+ readonly = self.screen.readonly or self.screen.group.readonly
if position >= 1:
name = str(position)
if self.domain is not None:
@@ -401,7 +401,7 @@ class WinForm(NoModal, InfoBar):
cancel_responses = [
Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT]
self.screen.current_view.set_value()
- readonly = self.screen.group.readonly
+ readonly = self.screen.readonly or self.screen.group.readonly
if (response_id not in cancel_responses
and not readonly
and self.screen.current_record is not None):