[ADD] bunch of tests
bzr revid: xmo@openerp.com-20110920122820-5ql07msi0zjljhxn
This commit is contained in:
parent
134437d3d1
commit
0166aeabff
|
@ -0,0 +1 @@
|
|||
# -*- coding: utf-8 -*-
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "Tests",
|
||||
"version": "2.0",
|
||||
"depends": [],
|
||||
"js": ["static/src/js/*.js"],
|
||||
"css": ['static/src/css/*.css'],
|
||||
'active': True,
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
.oe-bunchaforms > div {
|
||||
float: left;
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue