From 0ff62e941fa36670e6efce6594bdcffbebf5e0d5 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 16 May 2012 10:26:16 +0200 Subject: [PATCH] [FIX] Usability inconsistency -> exception: create != new + edit lp bug: https://launchpad.net/bugs/942053 fixed bzr revid: fme@openerp.com-20120516082616-xb7zv9gn56ggqq2j --- addons/web/static/src/js/view_page.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/web/static/src/js/view_page.js b/addons/web/static/src/js/view_page.js index b34fd0e358b..c266e5dc89b 100644 --- a/addons/web/static/src/js/view_page.js +++ b/addons/web/static/src/js/view_page.js @@ -24,10 +24,17 @@ openerp.web.page = function (openerp) { this.$form_header.find('button.oe_form_button_duplicate').click(this.on_button_duplicate); this.$form_header.find('button.oe_form_button_delete').click(this.on_button_delete); }, + do_show: function() { + if (this.dataset.index === null) { + this.dataset.index = this.previous_index || this.dataset.ids.length - 1; + } + this._super.apply(this, arguments); + }, on_button_edit: function() { return this.do_switch_view('form'); }, on_button_create: function() { + this.previous_index = this.dataset.index; this.dataset.index = null; return this.do_switch_view('form'); },