From b75f72f31851a0f38d13f3f29386c7fc70b1a717 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Fri, 7 Dec 2012 14:54:43 +0500 Subject: [PATCH] [IMP] When saving a note, it should come back to the kanban view instead of going to the page view. bzr revid: tta@openerp.com-20121207095443-xcaflcu887bsn96u --- addons/note/__openerp__.py | 3 +++ addons/note/static/src/js/note.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 addons/note/static/src/js/note.js diff --git a/addons/note/__openerp__.py b/addons/note/__openerp__.py index 797270637e2..4e22113e381 100644 --- a/addons/note/__openerp__.py +++ b/addons/note/__openerp__.py @@ -57,6 +57,9 @@ Notes can be found in the 'Home' menu. 'css': [ 'static/src/css/note.css', ], + 'js': [ + 'static/src/js/note.js', + ], 'installable': True, 'application': True, 'auto_install': False, diff --git a/addons/note/static/src/js/note.js b/addons/note/static/src/js/note.js new file mode 100644 index 00000000000..9b4a12c41a8 --- /dev/null +++ b/addons/note/static/src/js/note.js @@ -0,0 +1,16 @@ +openerp.note = function(instance) { + instance.web.FormView.include({ + init: function(parent, dataset, view_id, options) { + this._super(parent, dataset, view_id, options); + this.options.views_history = parent.views_history; + }, + to_view_mode: function(){ + var prev_view = this.options.views_history[this.options.views_history.length - 2]; + if(this.model == 'note.note' && prev_view == 'kanban'){ + this.do_switch_view(prev_view); + }else{ + this._super(); + } + }, + }); +}