From e395782ec3b86eaad78257a0680ce27bb4816cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 22 Feb 2025 23:55:57 +0100 Subject: [PATCH] Prevent saving record for readonly screen Closes #13885 --- sao/src/tab.js | 2 +- tryton/tryton/gui/window/form.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sao/src/tab.js b/sao/src/tab.js index fa1fa6aa69..1e9f1a6b32 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -887,7 +887,7 @@ this.screen.save_tree_state(); } var access = Sao.common.MODELACCESS.get(this.screen.model_name); - if (!(access.write || access.create)) { + if (this.screen.readonly || !(access.write || access.create)) { return jQuery.Deferred().reject(); } return this.screen.save_current().then( diff --git a/tryton/tryton/gui/window/form.py b/tryton/tryton/gui/window/form.py index 36e11a163a..26f37b6c4a 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -469,9 +469,9 @@ class Form(TabContent): if widget: # Called from button so we must save the tree state self.screen.save_tree_state() - if not (common.MODELACCESS[self.model]['write'] - or common.MODELACCESS[self.model]['create'] - or self.screen.writable): + if (self.screen.readonly + or not (common.MODELACCESS[self.model]['write'] + or common.MODELACCESS[self.model]['create'])): return if self.screen.save_current(): self.info_bar_add(_('Record saved.'), Gtk.MessageType.INFO)