summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-05-16 16:01:19 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-05-16 16:01:19 +0200
commitb836c3548c49f4bc667f96a4e13c7ca91a62ce7c (patch)
tree4c15ff8a01a3b5b4bce07264d541450793797dee /addons/web/static/src
parent8c4fad6beb7f0a571ca0fc739a7af251e9e9cece (diff)
[imp] made FormOpenPopup in creation mode
bzr revid: nicolas.vanhoren@openerp.com-20120516140119-e8n7y7uqqn9a2bho
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js44
1 files changed, 17 insertions, 27 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 6d9f0e93e66..f4c9d382478 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -3375,6 +3375,7 @@ instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({
},
init_dataset: function() {
var self = this;
+ this.created_elements = [];
this.dataset = new instance.web.ProxyDataSet(this, this.model, this.context);
this.dataset.read_function = this.options.read_function;
this.dataset.create_function = function(data, sup) {
@@ -3391,6 +3392,7 @@ instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({
this.dataset.child_name = this.options.child_name;
},
display_popup: function() {
+ var self = this;
this.renderElement();
instance.web.form.dialog(this.$element, {
close: function() {
@@ -3403,6 +3405,12 @@ instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({
on_write_completed: function() {},
setup_form_view: function() {
var self = this;
+ if (this.row_id) {
+ this.dataset.ids = [this.row_id];
+ this.dataset.index = 0;
+ } else {
+ this.dataset.index = null;
+ }
var options = _.clone(self.options.form_view_options) || {};
if (this.row_id !== null) {
options.initial_mode = this.options.readonly ? "view" : "edit";
@@ -3444,9 +3452,18 @@ instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({
self.view_form.do_show();
});
},
+ on_select_elements: function(element_ids) {
+ },
check_exit: function() {
+ if (this.created_elements.length > 0) {
+ this.on_select_elements(this.created_elements);
+ }
this.destroy();
},
+ destroy: function () {
+ this.$element.dialog('close');
+ this._super();
+ },
});
/**
@@ -3472,13 +3489,8 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
var self = this;
_.defaults(this.options, {
initial_view: "search",
- create_function: function() {
- return self.create_row.apply(self, arguments);
- },
- read_function: null,
});
this.initial_ids = this.options.initial_ids;
- this.created_elements = [];
this.display_popup();
},
start: function() {
@@ -3502,10 +3514,6 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
this.new_object();
}
},
- stop: function () {
- this.$element.dialog('close');
- this._super();
- },
setup_search_view: function(search_defaults) {
var self = this;
if (this.searchview) {
@@ -3563,15 +3571,6 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
self.view_list.do_search(results.domain, results.context, results.group_by);
});
},
- create_row: function() {
- var self = this;
- var wdataset = new instance.web.DataSetSearch(this, this.model, this.context, this.domain);
- wdataset.parent_view = this.options.parent_view;
- wdataset.child_name = this.options.child_name;
- return wdataset.create.apply(wdataset, arguments);
- },
- on_select_elements: function(element_ids) {
- },
on_click_element: function(ids) {
this.selected_ids = ids || [];
if(this.selected_ids.length > 0) {
@@ -3587,15 +3586,8 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
if (this.view_list) {
this.view_list.$element.hide();
}
- this.dataset.index = null;
this.setup_form_view();
},
- check_exit: function() {
- if (this.created_elements.length > 0) {
- this.on_select_elements(this.created_elements);
- }
- this._super();
- },
});
instance.web.form.SelectCreateListView = instance.web.ListView.extend({
@@ -3636,8 +3628,6 @@ instance.web.form.FormOpenPopup = instance.web.form.AbstractFormPopup.extend(/**
start: function() {
this._super();
this.init_dataset();
- this.dataset.ids = [this.row_id];
- this.dataset.index = 0;
this.setup_form_view();
},
});