summaryrefslogtreecommitdiff
path: root/addons/web_dashboard/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2011-12-13 12:19:53 +0100
committerXavier Morel <xmo@openerp.com>2011-12-13 12:19:53 +0100
commit7f63eb11cb798d08c8a329e9f867074c0b308332 (patch)
tree70dbfd8a4f64478622be2e7b0aa02c2a5f4bf901 /addons/web_dashboard/static/src
parent0e70f2c8d842f27174248898984a99a9925da62f (diff)
[FIX] restrict todos displayed in configuration widget to those matching the user's groups
bzr revid: xmo@openerp.com-20111213111953-diremmatzwwy5l6g
Diffstat (limited to 'addons/web_dashboard/static/src')
-rw-r--r--addons/web_dashboard/static/src/js/dashboard.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/addons/web_dashboard/static/src/js/dashboard.js b/addons/web_dashboard/static/src/js/dashboard.js
index aedbe0f26b3..fc2bb31ddb8 100644
--- a/addons/web_dashboard/static/src/js/dashboard.js
+++ b/addons/web_dashboard/static/src/js/dashboard.js
@@ -279,20 +279,29 @@ openerp.web_dashboard.ConfigOverview = openerp.web.View.extend({
template: 'ConfigOverview',
init: function (parent) {
this._super(parent);
- this.dataset = new openerp.web.DataSetSearch(
- this, 'ir.actions.todo');
- this.dataset.domain = [['type', '!=', 'automatic']];
+ this.user = _.extend(new openerp.web.DataSet(this, 'res.users'), {
+ index: 0,
+ ids: [this.session.uid]
+ });
+ this.dataset = new openerp.web.DataSetSearch(this, 'ir.actions.todo');
},
start: function () {
this._super();
- $.when(this.dataset.read_slice(['state', 'action_id', 'category_id']),
- this.dataset.call('progress'))
- .then(this.on_records_loaded);
- },
- on_records_loaded: function (read_response, progress_response) {
- var records = read_response,
- progress = progress_response[0];
+ var self = this;
+ return this.user.read_index(['groups_id']).pipe(function (record) {
+ var todos_filter = [
+ ['type', '!=', 'automatic'],
+ '|', ['groups_id', '=', false],
+ ['groups_id', 'in', record['groups_id']]];
+ return $.when(
+ self.dataset.read_slice(['state', 'action_id', 'category_id'],{
+ domain: todos_filter }),
+ self.dataset.call('progress').pipe(
+ function (arg) { return arg; }, null))
+ }, null).then(this.on_records_loaded);
+ },
+ on_records_loaded: function (records, progress) {
var grouped_todos = _(records).chain()
.map(function (record) {
return {