[FIX] have page view force a return to the previous view if switched to with no record
lp bug: https://launchpad.net/bugs/900225 fixed bzr revid: xmo@openerp.com-20111219125039-049o944efkkl2sk9
This commit is contained in:
parent
eec5f1c6c4
commit
d8df2d5e17
|
@ -252,14 +252,18 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet
|
|||
},
|
||||
previous: function () {
|
||||
this.index -= 1;
|
||||
if (this.index < 0) {
|
||||
if (!this.ids.length) {
|
||||
this.index = null;
|
||||
} else if (this.index < 0) {
|
||||
this.index = this.ids.length - 1;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
next: function () {
|
||||
this.index += 1;
|
||||
if (this.index >= this.ids.length) {
|
||||
if (!this.ids.length) {
|
||||
this.index = null;
|
||||
} else if (this.index >= this.ids.length) {
|
||||
this.index = 0;
|
||||
}
|
||||
return this;
|
||||
|
|
|
@ -10,6 +10,13 @@ openerp.web.page = function (openerp) {
|
|||
this._super.apply(this, arguments);
|
||||
this.registry = openerp.web.page.readonly;
|
||||
},
|
||||
reload: function () {
|
||||
if (this.dataset.index == null) {
|
||||
this.do_prev_view();
|
||||
return $.Deferred().reject().promise();
|
||||
}
|
||||
return this._super();
|
||||
},
|
||||
on_loaded: function(data) {
|
||||
this._super(data);
|
||||
this.$form_header.find('button.oe_form_button_edit').click(this.on_button_edit);
|
||||
|
|
Loading…
Reference in New Issue