31
31
this.$element.delegate('.oe-dashboard-column .oe-dashboard-fold', 'click', this.on_fold_action);
32
32
this.$element.delegate('.oe-dashboard-column .ui-icon-closethick', 'click', this.on_close_action);
34
this.actions_attrs = {};
36
35
_.each(this.node.children, function(column, column_index) {
37
36
_.each(column.children, function(action, action_index) {
38
37
delete(action.attrs.width);
39
38
delete(action.attrs.height);
40
39
delete(action.attrs.colspan);
41
self.actions_attrs[action.attrs.name] = action.attrs;
42
40
self.rpc('/web/action/load', {
43
41
action_id: parseInt(action.attrs.name, 10)
44
42
}, function(result) {
45
self.on_load_action(result, column_index + '_' + action_index);
43
self.on_load_action(result, column_index + '_' + action_index, action.attrs);
97
95
$action = $e.parents('.oe-dashboard-action:first'),
98
96
id = parseInt($action.attr('data-id'), 10);
99
97
if ($e.is('.ui-icon-minusthick')) {
100
this.actions_attrs[id].fold = '1';
98
$action.data('action_attrs').fold = '1';
102
delete(this.actions_attrs[id].fold);
100
delete($action.data('action_attrs').fold);
104
102
$e.toggleClass('ui-icon-minusthick ui-icon-plusthick');
105
103
$action.find('.oe-dashboard-action-content').toggle();
122
120
var actions = [];
123
121
$(this).find('.oe-dashboard-action').each(function() {
124
122
var action_id = $(this).attr('data-id'),
125
new_attrs = _.clone(self.actions_attrs[action_id]);
123
new_attrs = _.clone($(this).data('action_attrs'));
126
124
if (new_attrs.domain) {
127
125
new_attrs.domain = new_attrs.domain_string;
128
126
delete(new_attrs.domain_string);
143
141
self.$element.find('.oe-dashboard-link-reset').show();
146
on_load_action: function(result, index) {
144
on_load_action: function(result, index, action_attrs) {
148
146
action = result.result,
149
action_attrs = this.actions_attrs[action.id],
150
147
view_mode = action_attrs.view_mode;
152
if (action_attrs.context) {
153
action.context = _.extend((action.context || {}), action_attrs.context);
155
if (action_attrs.domain) {
156
action.domain = action.domain || [];
157
action.domain.unshift.apply(action.domain, action_attrs.domain);
149
if (action_attrs.context && action_attrs.context['dashboard_merge_domains_contexts'] === false) {
150
// TODO: replace this 6.1 workaround by attribute on <action/>
151
action.context = action_attrs.context || {};
152
action.domain = action_attrs.domain || [];
154
if (action_attrs.context) {
155
action.context = _.extend((action.context || {}), action_attrs.context);
157
if (action_attrs.domain) {
158
action.domain = action.domain || [];
159
action.domain.unshift.apply(action.domain, action_attrs.domain);
159
163
var action_orig = _.extend({ flags : {} }, action);
161
165
if (view_mode && view_mode != action.view_mode) {
187
191
var am = new openerp.web.ActionManager(this),
188
192
// FIXME: ideally the dashboard view shall be refactored like kanban.
189
193
$action = $('#' + this.view.element_id + '_action_' + index);
194
$action.parent().data('action_attrs', action_attrs);
190
195
this.action_managers.push(am);
191
196
am.appendTo($action);
192
197
am.do_action(action);