From fed8553febfbdea9df7aea0ed4cec521e6eeb32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 20 Apr 2018 18:38:15 +0200 Subject: [PATCH] Get initial value only when cancel button is on window form The initial value is only useful with the view type is form otherwise screen may not have a current record like in Attachment. issue7377 review36221002 --- src/window.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/window.js b/src/window.js index 6e7a45307d..db5e26bd14 100644 --- a/src/window.js +++ b/src/window.js @@ -86,9 +86,12 @@ this._initial_value = null; if (view_type == 'form') { - var button_text = Sao.i18n.gettext('Cancel'); + var button_text; if (kwargs.new_) { button_text = Sao.i18n.gettext('Delete'); + } else { + button_text = Sao.i18n.gettext('Cancel'); + this._initial_value = this.screen.current_record.get_eval(); } dialog.footer.append(jQuery('