[ADD] handling of group_by_no_leaf
bzr revid: xmo@openerp.com-20110524091125-ltohsi2zy6nbmi3p
This commit is contained in:
parent
8a50dd1609
commit
7758f281ed
|
@ -106,9 +106,12 @@ openerp.base.ContainerDataGroup = openerp.base.DataGroup.extend(
|
||||||
__domain: group.__domain,
|
__domain: group.__domain,
|
||||||
|
|
||||||
grouped_on: field_name,
|
grouped_on: field_name,
|
||||||
length: group[field_name + '_count'],
|
// if terminal group and group_by_no_leaf => use group.__count
|
||||||
|
length: group[field_name + '_count'] || group.__count,
|
||||||
value: group[field_name],
|
value: group[field_name],
|
||||||
|
|
||||||
|
has_leaves: _.isUndefined(group.__count),
|
||||||
|
|
||||||
aggregates: aggregates
|
aggregates: aggregates
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -253,10 +253,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
|
||||||
* sequence
|
* sequence
|
||||||
*/
|
*/
|
||||||
do_reload: function (primary_columns) {
|
do_reload: function (primary_columns) {
|
||||||
// TODO: need to do 5 billion tons of pre-processing, bypass
|
// TODO: should just fields_view_get I think
|
||||||
// DataSet for now
|
|
||||||
//self.dataset.read_slice(self.dataset.fields, 0, self.limit,
|
|
||||||
// self.do_fill_table);
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.dataset.offset = 0;
|
this.dataset.offset = 0;
|
||||||
this.dataset.limit = false;
|
this.dataset.limit = false;
|
||||||
|
@ -554,18 +551,21 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr
|
||||||
var self = this;
|
var self = this;
|
||||||
var placeholder = this.make_fragment();
|
var placeholder = this.make_fragment();
|
||||||
_(datagroups).each(function (group) {
|
_(datagroups).each(function (group) {
|
||||||
var $row = $('<tr>').click(function (e) {
|
var $row = $('<tr>');
|
||||||
if (!$row.data('open')) {
|
if (group.has_leaves) {
|
||||||
$row.data('open', true);
|
$row.click(function (e) {
|
||||||
self.open_group(e, group);
|
if (!$row.data('open')) {
|
||||||
} else {
|
$row.data('open', true);
|
||||||
$row.removeData('open')
|
self.open_group(e, group);
|
||||||
.find('span.ui-icon')
|
} else {
|
||||||
.removeClass('ui-icon-triangle-1-s')
|
$row.removeData('open')
|
||||||
.addClass('ui-icon-triangle-1-e');
|
.find('span.ui-icon')
|
||||||
_(self.children).each(function (child) {child.apoptosis();});
|
.removeClass('ui-icon-triangle-1-s')
|
||||||
}
|
.addClass('ui-icon-triangle-1-e');
|
||||||
});
|
_(self.children).each(function (child) {child.apoptosis();});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
placeholder.appendChild($row[0]);
|
placeholder.appendChild($row[0]);
|
||||||
self.pad($row);
|
self.pad($row);
|
||||||
|
|
||||||
|
@ -573,12 +573,17 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr
|
||||||
.filter(function (column) {return !column.invisible;})
|
.filter(function (column) {return !column.invisible;})
|
||||||
.each(function (column) {
|
.each(function (column) {
|
||||||
if (column.id === '_group') {
|
if (column.id === '_group') {
|
||||||
self.indent($('<th>')
|
var $group_column = $('<th>')
|
||||||
.text((group.value instanceof Array ? group.value[1] : group.value))
|
.text((group.value instanceof Array ? group.value[1] : group.value))
|
||||||
.prepend('<span class="ui-icon ui-icon-triangle-1-e">')
|
.appendTo($row);
|
||||||
.appendTo($row), group.level);
|
if (group.has_leaves) {
|
||||||
|
$group_column
|
||||||
|
.prepend('<span class="ui-icon ui-icon-triangle-1-e">');
|
||||||
|
}
|
||||||
|
self.indent($group_column, group.level);
|
||||||
} else if (column.id === '_count') {
|
} else if (column.id === '_count') {
|
||||||
$('<td>').text(group.length).appendTo($row);
|
$('<td>').text(group.has_leaves ? group.length : '')
|
||||||
|
.appendTo($row);
|
||||||
} else if (column.id in group.aggregates) {
|
} else if (column.id in group.aggregates) {
|
||||||
var value = group.aggregates[column.id];
|
var value = group.aggregates[column.id];
|
||||||
var format;
|
var format;
|
||||||
|
|
Loading…
Reference in New Issue