summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2011-06-20 20:26:41 +0200
committerFabien Meghazi <fme@openerp.com>2011-06-20 20:26:41 +0200
commitd01e7d033ccbe8cf37a10a7edd3b1db3da36f1c4 (patch)
tree89d5cab8dbda5a7705ca06c3989ee478afdb180b
parentf4c96f15941bd87296f27974c970a2a2920f4e5f (diff)
[FIX] Create new record in form view when dataset index is 0 and has empty ids list.
This fixes problems for wizards and when switching to form view when dataset is empty bzr revid: fme@openerp.com-20110620182641-u5vmyb5za7wvpefq
-rw-r--r--addons/base/static/src/js/form.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/base/static/src/js/form.js b/addons/base/static/src/js/form.js
index 9bbbfda3346..90357325928 100644
--- a/addons/base/static/src/js/form.js
+++ b/addons/base/static/src/js/form.js
@@ -72,8 +72,9 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormV
do_show: function () {
var self = this;
self.$element.show();
- if (this.dataset.index === null) {
+ if (this.dataset.index === null || (this.dataset.index === 0 && this.dataset.ids.length == 0)) {
// null index means we should start a new record
+ // 0 index with empty ids means we called the form with empty dataset (wizards, switched to form from empty list, ...)
this.on_button_new();
} else {
this.dataset.read_index(_.keys(this.fields_view.fields), this.on_record_loaded);