summaryrefslogtreecommitdiff
path: root/addons/base/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2011-04-22 17:54:52 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2011-04-22 17:54:52 +0200
commit0ae1e8f2b9b6d5d499b145302bc982fcaf7faa4a (patch)
tree1482d70c68043852d99def98de2f8821a004ca44 /addons/base/static/src
parentceb524e3376d92dde25e68dd7d74b6de0a5c8a6d (diff)
[IMP] Some code about many2many widgets.
bzr revid: nicolas.vanhoren@openerp.com-20110422155452-9lth3lrm8pwf9c2r
Diffstat (limited to 'addons/base/static/src')
-rw-r--r--addons/base/static/src/js/form.js16
-rw-r--r--addons/base/static/src/js/list.js8
-rw-r--r--addons/base/static/src/xml/base.xml1
3 files changed, 22 insertions, 3 deletions
diff --git a/addons/base/static/src/js/form.js b/addons/base/static/src/js/form.js
index 84d7fe0babd..ea2b377078b 100644
--- a/addons/base/static/src/js/form.js
+++ b/addons/base/static/src/js/form.js
@@ -896,6 +896,22 @@ openerp.base.form.FieldMany2Many = openerp.base.form.Field.extend({
init: function(view, node) {
this._super(view, node);
this.template = "FieldMany2Many";
+ this.list_id = _.uniqueId("many2many");
+ },
+ start: function() {
+ debugger;
+ this._super.apply(this, arguments);
+ this.dataset = new openerp.base.DataSetSearch(this.session, this.field.relation);
+ this.list_view = new openerp.base.ListView(undefined, this.view.session,
+ this.list_id, this.dataset, false, undefined);
+ this.list_view.start();
+ },
+ set_value: function(value) {
+ if (value != false) {
+ this.dataset.ids = value;
+ this.dataset.count = value.length;
+ this.list_view.do_update();
+ }
}
});
diff --git a/addons/base/static/src/js/list.js b/addons/base/static/src/js/list.js
index 8035616e59a..aa9882aed36 100644
--- a/addons/base/static/src/js/list.js
+++ b/addons/base/static/src/js/list.js
@@ -64,7 +64,7 @@ openerp.base.ListView = openerp.base.Controller.extend(
return this.rpc("/base/listview/load", {
model: this.model,
view_id: this.view_id,
- toolbar: !!this.view_manager.sidebar
+ toolbar: this.view_manager ? !!this.view_manager.sidebar : false
}, this.on_loaded);
},
/**
@@ -168,7 +168,7 @@ openerp.base.ListView = openerp.base.Controller.extend(
'tr', 'click', this.on_select_row);
// sidebar stuff
- if (this.view_manager.sidebar) {
+ if (this.view_manager && this.view_manager.sidebar) {
this.view_manager.sidebar.set_toolbar(data.fields_view.toolbar);
}
},
@@ -262,7 +262,9 @@ openerp.base.ListView = openerp.base.Controller.extend(
view = view || 'form';
this.dataset.index = index;
_.delay(_.bind(function () {
- this.view_manager.on_mode_switch(view);
+ if(this.view_manager) {
+ this.view_manager.on_mode_switch(view);
+ }
}, this));
},
/**
diff --git a/addons/base/static/src/xml/base.xml b/addons/base/static/src/xml/base.xml
index b49ef2c7d6a..4804f34d785 100644
--- a/addons/base/static/src/xml/base.xml
+++ b/addons/base/static/src/xml/base.xml
@@ -353,6 +353,7 @@
<t t-name="FieldMany2Many">
<div style="background: #ccc; padding: 20px">
Many2Many widget
+ <div t-attr-id="widget.list_id"></div>
</div>
</t>
<t t-name="FieldReference">