diff --git a/addons/web/doc/index.rst b/addons/web/doc/index.rst index 650c12f55ec..35cd3b23afa 100644 --- a/addons/web/doc/index.rst +++ b/addons/web/doc/index.rst @@ -3,8 +3,12 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to OpenERP Web's documentation! -======================================= +OpenERP Web Reference Documentation +=================================== + +See also the `OpenERP Web Training`_. + +.. _OpenERP Web Training: https://doc.openerp.com/trunk/training/ Basics ------ diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 26807a2ee0f..04f657d91f7 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -61,18 +61,19 @@ instance.web.Query = instance.web.Class.extend({ }, _execute: function () { var self = this; - return this._model.call('search_read', { + return instance.session.rpc('/web/dataset/search_read', { + model: this._model.name, + fields: this._fields || false, domain: instance.web.pyeval.eval('domains', [this._model.domain(this._filter)]), - fields: this._fields || false, - offset: this._offset, - limit: this._limit, - order: instance.web.serialize_sort(this._order_by), context: instance.web.pyeval.eval('contexts', [this._model.context(this._context)]), + offset: this._offset, + limit: this._limit, + sort: instance.web.serialize_sort(this._order_by) }).then(function (results) { self._count = results.length; - return results; + return results.records; }, null); }, /** @@ -450,7 +451,7 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin, // TODO: reorder results to match ids list return this._model.call('read', [ids, fields || false], - {context: this._model.context(options.context)}); + {context: this.get_context(options.context)}); }, /** * Read a slice of the records represented by this DataSet, based on its diff --git a/addons/web/static/src/js/view_tree.js b/addons/web/static/src/js/view_tree.js index 0c101e330c9..2f92042c4d0 100644 --- a/addons/web/static/src/js/view_tree.js +++ b/addons/web/static/src/js/view_tree.js @@ -166,13 +166,13 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie var is_loaded = 0, $this = $(this), record_id = $this.data('id'), - parent_id = $this.data('parent-id'), + row_parent_id = $this.data('row-parent-id'), record = self.records[record_id], children_ids = record[self.children_field]; _(children_ids).each(function(childid) { - if (self.$el.find('[id=treerow_' + childid + '][data-parent-id='+ record_id +']').length ) { - if (self.$el.find('[id=treerow_' + childid + '][data-parent-id='+ record_id +']').is(':hidden')) { + if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').length ) { + if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').is(':hidden')) { is_loaded = -1; } else { is_loaded++; @@ -196,7 +196,6 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie _(records).each(function (record) { self.records[record.id] = record; }); - var $curr_node = self.$el.find('#treerow_' + id); var children_rows = QWeb.render('TreeView.rows', { 'records': records, @@ -206,7 +205,7 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie 'level': $curr_node.data('level') || 0, 'render': instance.web.format_value, 'color_for': self.color_for, - 'parent_id': id + 'row_parent_id': id }); if ($curr_node.length) { $curr_node.addClass('oe_open'); @@ -250,7 +249,7 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie showcontent: function (curnode,record_id, show) { curnode.parent('tr').toggleClass('oe_open', show); _(this.records[record_id][this.children_field]).each(function (child_id) { - var $child_row = this.$el.find('[id=treerow_' + child_id + '][data-parent-id='+ curnode.data('id') +']'); + var $child_row = this.$el.find('[id=treerow_' + child_id + '][data-row-parent-id='+ curnode.data('id') +']'); if ($child_row.hasClass('oe_open')) { $child_row.toggleClass('oe_open',show); this.showcontent($child_row, child_id, false); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index d21318799c9..ee87237d045 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -685,7 +685,7 @@ t-foreach="records" t-as="record" t-att-id="'treerow_' + record.id" t-att-data-id="record.id" t-att-data-level="level + 1" - t-att-data-parent-id="parent_id"> + t-att-data-row-parent-id="row_parent_id"> diff --git a/addons/web/static/test/data.js b/addons/web/static/test/data.js index bddf698ede9..d7a957ad920 100644 --- a/addons/web/static/test/data.js +++ b/addons/web/static/test/data.js @@ -18,16 +18,16 @@ openerp.testing.section('data.model.group_by', { "should have single grouping field"); return group_result; }); - mock('foo:search_read', function (args, kwargs) { - deepEqual(kwargs.domain, [['bar', '=', 3]], + mock('/web/dataset/search_read', function (args) { + deepEqual(args.params.domain, [['bar', '=', 3]], "should have domain matching that of group_by result"); - return [ + return {records: [ {bar: 3, id: 1}, {bar: 3, id: 2}, {bar: 3, id: 4}, {bar: 3, id: 8}, {bar: 3, id: 16} - ]; + ], length: 5}; }); return m.query().group_by('bar')