diff options
| author | Fabien Meghazi <fme@openerp.com> | 2012-05-16 10:26:16 +0200 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2012-05-16 10:26:16 +0200 |
| commit | 0ff62e941fa36670e6efce6594bdcffbebf5e0d5 (patch) | |
| tree | 6f7fc272c8c8d73ef56ce6195950339ba5dab2cb | |
| parent | 28e4d3a2864b4267673c123478c36c2dfe03a904 (diff) | |
[FIX] Usability inconsistency -> exception: create != new + edit
lp bug: https://launchpad.net/bugs/942053 fixed
bzr revid: fme@openerp.com-20120516082616-xb7zv9gn56ggqq2j
| -rw-r--r-- | addons/web/static/src/js/view_page.js | 7 |
1 files changed, 7 insertions, 0 deletions
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'); }, |
