diff options
| author | Gery Debongnie <ged@openerp.com> | 2013-11-15 16:37:01 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2013-11-15 16:37:01 +0100 |
| commit | 08a26f9e95ab5a432385d803679eba030fcb6673 (patch) | |
| tree | ac94daa678a5405113253342f43d05ed7b7d4dfa /addons/web_graph/static/src/js/graph.js | |
| parent | b08a38c5286ddca7945ed73938e53b0d7e98dbd2 (diff) | |
[REF] refactoring in progress. moves some util functions to its own file in addon web_graph
bzr revid: ged@openerp.com-20131115153701-rxh1voksnu0ule4t
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index ccec8f03ec3..48fa416ba75 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -511,45 +511,5 @@ var PivotTable = BasicDataView.extend({ }); -//////////////////////////////////////////////////////////////////////////////// -// utility -function removeFromArray(array, element) { - var index = array.indexOf(element); - if (index > -1) { - array.splice(index, 1); - } -} - -/** - * Query the server and return a deferred which will return the data - * with all the groupbys applied (this is done for now, but the goal - * is to modify read_group in order to allow eager and lazy groupbys - */ -function query_groups (model, fields, domain, groupbys) { - return model.query(fields) - .filter(domain) - .group_by(groupbys) - .then(function (results) { - var non_empty_results = _.filter(results, function (group) { - return group.attributes.length > 0; - }); - if (groupbys.length <= 1) { - return non_empty_results; - } else { - var get_subgroups = $.when.apply(null, _.map(non_empty_results, function (result) { - var new_domain = result.model._domain; - var new_groupings = groupbys.slice(1); - return query_groups(model, fields,new_domain, new_groupings).then(function (subgroups) { - result.subgroups_data = subgroups; - }); - })); - return get_subgroups.then(function () { - return non_empty_results; - }); - } - }); -} - - }; |
