Merge lp:~therp-nl/openerp-web/6.1_groups_in_dashboards_lp1103919 into lp:openerp-web/6.1

Proposed by Holger Brunn (Therp)
Status: Needs review
Proposed branch: lp:~therp-nl/openerp-web/6.1_groups_in_dashboards_lp1103919
Merge into: lp:openerp-web/6.1
Diff against target: 27 lines (+17/-0)
1 file modified
addons/web_dashboard/static/src/js/dashboard.js (+17/-0)
To merge this branch: bzr merge lp:~therp-nl/openerp-web/6.1_groups_in_dashboards_lp1103919
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+144709@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

2455. By Holger Brunn (Therp)

[FIX] respect group_ids for actions in dashboards

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web_dashboard/static/src/js/dashboard.js'
2--- addons/web_dashboard/static/src/js/dashboard.js 2012-05-18 08:51:05 +0000
3+++ addons/web_dashboard/static/src/js/dashboard.js 2013-01-24 14:38:26 +0000
4@@ -145,6 +145,23 @@
5 action = result.result,
6 view_mode = action_attrs.view_mode;
7
8+ if (result.result.groups_id && result.result.groups_id.length) {
9+ if (openerp.connection.user_groups_id) {
10+ if (_.intersection(openerp.connection.user_groups_id, result.result.groups_id).length==0) {
11+ jQuery('#' + this.view.element_id + '_action_' + index).parent().remove();
12+ return;
13+ }
14+ }
15+ else {
16+ new openerp.web.Model('res.users').call('read', [openerp.connection.uid, ['groups_id']], {}).then(
17+ function(result2) {
18+ openerp.connection.user_groups_id=result2.groups_id;
19+ self.on_load_action(result, index, action_attrs);
20+ });
21+ return;
22+ }
23+ }
24+
25 if (action_attrs.context && action_attrs.context['dashboard_merge_domains_contexts'] === false) {
26 // TODO: replace this 6.1 workaround by attribute on <action/>
27 action.context = action_attrs.context || {};