this.client_widget = null;
},
render: function() {
- return "<div id='"+this.element_id+"'></div>";
+ return '<div id="' + this.element_id + '" style="height: 100%;"></div>';
},
dialog_stop: function () {
if (this.dialog) {
},
do_push_state: function(state) {
if (this.widget_parent && this.widget_parent.do_push_state) {
- if (this.inner_action && this.inner_action.id) {
- state['action_id'] = this.inner_action.id;
+ if (this.inner_action) {
+ if (this.inner_action.id) {
+ state['action_id'] = this.inner_action.id;
+ } else {
+ state['model'] = this.inner_action.res_model;
+ }
}
this.widget_parent.do_push_state(state);
}
}
}
else if (state.model && state.id) {
- // TODO implement it
- //this.null_action();
- //action = {res_model: state.model, res_id: state.id};
- //action_loaded = this.do_action(action);
+ // TODO handle context & domain ?
+ this.null_action();
+ var action = {
+ res_model: state.model,
+ res_id: state.id,
+ type: 'ir.actions.act_window',
+ views: [[false, 'page'], [false, 'form']]
+ };
+ action_loaded = this.do_action(action);
}
else if (state.client_action) {
this.null_action();
search_view : !popup,
action_buttons : !popup,
sidebar : !popup,
- pager : !popup
+ pager : !popup,
+ display_title : !popup
}, action.flags || {});
if (!(type in this)) {
console.error("Action manager can't handle action of type " + action.type, action);
this.dialog_viewmanager.appendTo(this.dialog.$element);
this.dialog.open();
} else {
+ if(action.menu_id) {
+ return this.widget_parent.do_action(action, function () {
+ session.webclient.menu.open_menu(action.menu_id);
+ });
+ }
this.dialog_stop();
this.content_stop();
this.inner_action = action;
$res_logs.removeClass('oe-folded');
return false;
}).delegate('a.oe-remove-everything', 'click', function () {
- $res_logs.removeClass('oe-has-more')
- .find('ul').empty();
+ $res_logs.removeClass('oe-has-more').find('ul').empty();
+ $res_logs.css('display','none');
return false;
});
+ $res_logs.css('display','none');
return manager_ready;
},
view_mode : 'form',
target : 'new',
flags : {
- action_buttons : true
+ action_buttons : true,
+ form : {
+ resize_textareas : true
+ }
}
};
if (id) {
return $.when(this._super(view_type, no_store)).then(function () {
self.shortcut_check(self.views[view_type]);
- self.$element.find('.oe-view-manager-logs:first')
- .addClass('oe-folded').removeClass('oe-has-more')
- .find('ul').empty();
+ self.$element.find('.oe-view-manager-logs:first').addClass('oe-folded').removeClass('oe-has-more').css('display','none').find('ul').empty();
var controller = self.views[self.active_view].controller,
fvg = controller.fields_view,
var $title = self.$element.find('.oe_view_title_text'),
$search_prefix = $title.find('span.oe_searchable_view');
- if (controller.searchable !== false) {
+ if (controller.searchable !== false && self.flags.search_view !== false) {
if (!$search_prefix.length) {
$title.prepend('<span class="oe_searchable_view">' + _t("Search: ") + '</span>');
}
* @param {Array<Object>} log_records
*/
do_display_log: function (log_records) {
- var self = this,
- cutoff = 3,
- $logs = this.$element.find('.oe-view-manager-logs:first')
- .addClass('oe-folded'),
- $logs_list = $logs.find('ul').empty();
+ var self = this;
+ var cutoff = 3;
+ var $logs = this.$element.find('.oe-view-manager-logs:first').addClass('oe-folded').css('display', 'block');
+ var $logs_list = $logs.find('ul').empty();
$logs.toggleClass('oe-has-more', log_records.length > cutoff);
_(log_records.reverse()).each(function (record) {
$(_.str.sprintf('<li><a href="#">%s</a></li>', record.name))
label: _t("Edit Workflow"),
callback: view.on_sidebar_edit_workflow,
title: _t("Manage views of the current object"),
- classname: 'oe_hide oe_sidebar_edit_workflow'
+ classname: 'oe_sidebar_edit_workflow'
}, {
label: _t("Customize Object"),
callback: view.on_sidebar_customize_object,
additional_context);
result.result.flags = result.result.flags || {};
result.result.flags.new_window = true;
- self.do_action(result.result);
+ self.do_action(result.result, function () {
+ // reload view
+ self.widget_parent.reload();
+ });
});
});
},
}
},
on_sidebar_edit_workflow: function() {
- console.log('Todo');
+ return this.do_action({
+ res_model : 'workflow',
+ domain : [['osv', '=', this.dataset.model]],
+ views: [[false, 'list'], [false, 'form']],
+ type : 'ir.actions.act_window',
+ view_type : "list",
+ view_mode : "list"
+ });
},
on_sidebar_customize_object: function() {
var self = this;
on_sidebar_view_log: function() {
},
sidebar_context: function () {
- return $.Deferred().resolve({}).promise();
+ return $.when();
+ },
+ /**
+ * Asks the view to reload itself, if the reloading is asynchronous should
+ * return a {$.Deferred} indicating when the reloading is done.
+ */
+ reload: function () {
+ return $.when();
}
});