summaryrefslogtreecommitdiff
path: root/addons/web_tests/static/src/js
diff options
context:
space:
mode:
authorsma (Tiny) <sma@tinyerp.com>2011-10-03 16:57:31 +0530
committersma (Tiny) <sma@tinyerp.com>2011-10-03 16:57:31 +0530
commit7e9e542418f791b024de401236eeb8e006be42d4 (patch)
tree91e49927b0de50c8c690a2eb608b425a12b4ac7c /addons/web_tests/static/src/js
parent3e11ca62990fde34e537e233e3b099d22f8c8373 (diff)
parent2dae9519d7c3d0a4c2217b63939bb4eb1d83d39d (diff)
[MERGE]
bzr revid: sma@tinyerp.com-20110926105300-72fwa60uvvdf1qgg bzr revid: sma@tinyerp.com-20111003112731-uobxur1ryqb5laxy
Diffstat (limited to 'addons/web_tests/static/src/js')
-rw-r--r--addons/web_tests/static/src/js/web_tests.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/addons/web_tests/static/src/js/web_tests.js b/addons/web_tests/static/src/js/web_tests.js
new file mode 100644
index 00000000000..b21275d1eb7
--- /dev/null
+++ b/addons/web_tests/static/src/js/web_tests.js
@@ -0,0 +1,37 @@
+openerp.web_tests = function (db) {
+ db.web.client_actions.add(
+ 'buncha-forms', 'instance.web_tests.BunchaForms');
+ db.web_tests = {};
+ db.web_tests.BunchaForms = db.web.Widget.extend({
+ init: function (parent) {
+ this._super(parent);
+ this.dataset = new db.web.DataSetSearch(this, 'test.listview.relations');
+ this.form = new db.web.FormView(this, this.dataset, false, {
+ action_buttons: false,
+ pager: false
+ });
+ this.form.registry = db.web.form.readonly;
+ },
+ render: function () {
+ return '<div class="oe-bunchaforms"></div>';
+ },
+ start: function () {
+ $.when(
+ this.dataset.read_slice(),
+ this.form.appendTo(this.$element)).then(this.on_everything_loaded);
+ },
+ on_everything_loaded: function (slice) {
+ var records = slice[0].records;
+ if (!records.length) {
+ this.form.on_record_loaded({});
+ return;
+ }
+ this.form.on_record_loaded(records[0]);
+ _(records.slice(1)).each(function (record, index) {
+ this.dataset.index = index+1;
+ this.form.reposition($('<div>').appendTo(this.$element));
+ this.form.on_record_loaded(record);
+ }, this);
+ }
+ });
+};