Do not use save button for readonly screen
Even if save_current is set, a readonly screen is never saved on response. Closes #12538
This commit is contained in:
1 parent
6b1dacb441
commit
a72acf0402
2 files changed
+7
-8
No files matched your search
+4
-5
@@ -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('<button/>', {
|
||||
'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) {
|
||||
|
||||
@@ -101,7 +101,7 @@ class WinForm(NoModal, InfoBar):
|
||||
self.but_new.set_always_show_image(True)
|
||||
self.but_new.set_accel_path('<tryton>/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):
|
||||
|
||||
Reference in new issue
Block a user