From 330319b6bde4bf65d55e663acb724aacb4f9694e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 25 May 2016 11:14:15 +0200 Subject: [PATCH] Remove Screen.parent hack in Attachment and Note The modified test in Screen.switch_view can be moved to Screen.default_row_activate only, so the Attachment and Note screen doesn't require to have a fake parent to switch views. issue5558 review23131002 --- src/screen.js | 7 +++---- src/window.js | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/screen.js b/src/screen.js index df7baceac1..f176ab6105 100644 --- a/src/screen.js +++ b/src/screen.js @@ -702,9 +702,6 @@ }, switch_view: function(view_type) { if (this.current_view) { - if (!this.group.parent && this.modified()) { - return jQuery.when(); - } this.current_view.set_value(); if (this.current_record && !~this.current_record.group.indexOf( @@ -960,7 +957,9 @@ 'ids': [this.get_id()] }, jQuery.extend({}, this.context), false); } else { - this.switch_view('form'); + if (!this.modified()) { + this.switch_view('form'); + } } }, get_id: function() { diff --git a/src/window.js b/src/window.js index 7cff75d643..de32a491ef 100644 --- a/src/window.js +++ b/src/window.js @@ -393,7 +393,6 @@ }); screen.switch_view().done(function() { screen.search_filter(); - screen.group.parent = record; }); Sao.Window.Attachment._super.init.call(this, screen, this.callback, {view_type: 'tree'}); @@ -427,7 +426,6 @@ }); screen.switch_view().done(function() { screen.search_filter(); - screen.group.parent = record; }); Sao.Window.Note._super.init.call(this, screen, this.callback, {view_type: 'tree'});