[FIX] *: adapt addons to views refactoring of previous commit

This commit is contained in:
Aaron Bohy
2016-03-18 10:44:52 +01:00
parent 002660a9b0
commit bda451ab31
5 changed files with 21 additions and 13 deletions
@@ -493,21 +493,20 @@ var abstractReconciliationLine = Widget.extend({
// field_manager
var dataset = new data.DataSet(this, "account.account", self.context);
dataset.ids = [];
dataset.arch = {
var fields_view = {};
fields_view.arch = {
attrs: { string: "Stéphanie de Monaco", version: "7.0", class: "oe_form_container o_form_container" },
children: [],
tag: "form"
};
self.field_manager = new FormView (
this, dataset, false, {
this, dataset, fields_view, {
initial_mode: 'edit',
disable_autofocus: false,
$buttons: $(),
$pager: $()
});
self.field_manager.load_form(dataset);
self.field_manager.appendTo(document.createDocumentFragment()); // starts the FormView
// fields default properties
var Default_field = function() {
+2 -1
View File
@@ -9,7 +9,8 @@ var _t = core._t;
Sidebar.include({
init : function(){
this._super.apply(this, arguments);
if (this.getParent().view_type == "form"){
var view = this.getParent();
if (view.fields_view && view.fields_view.type === "form") {
this.sections.splice(1, 0, { 'name' : 'files', 'label' : _t('Attachment(s)'), });
this.items.files = [];
}
@@ -27,8 +27,8 @@ FormView.include({
});
FavoriteMenu.include({
prepare_dropdown_menu: function (filters) {
this._super(filters);
start: function () {
this._super();
var am = this.findAncestor(function(a) {
return a instanceof ActionManager;
});
+13 -4
View File
@@ -160,6 +160,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
init: function(parent, action, options) {
this._super.apply(this, arguments);
this.action_manager = parent;
this.dataset = new data.DataSetSearch(this, 'mail.message');
this.domain = [];
this.action = action;
this.options = options || {};
@@ -170,7 +171,17 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
},
willStart: function () {
return chat_manager.is_ready;
var self = this;
var view_id = this.action && this.action.search_view_id && this.action.search_view_id[0];
var def = this.dataset._model.fields_view_get({
view_id: view_id,
view_type: 'search',
context: this.dataset.get_context(),
toolbar: false,
}).then(function (fields_view) {
self.fields_view = fields_view;
});
return $.when(this._super(), chat_manager.is_ready, def);
},
start: function() {
@@ -182,8 +193,6 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
action: this.action,
disable_groupby: true,
};
var dataset = new data.DataSetSearch(this, 'mail.message');
var view_id = (this.action && this.action.search_view_id && this.action.search_view_id[0]) || false;
var default_channel_id = this.options.active_id ||
this.action.context.active_id ||
this.action.params.default_active_id ||
@@ -191,7 +200,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
var default_channel = chat_manager.get_channel(default_channel_id) ||
chat_manager.get_channel('channel_inbox');
this.searchview = new SearchView(this, dataset, view_id, {}, options);
this.searchview = new SearchView(this, this.dataset, this.fields_view, options);
this.searchview.on('search_data', this, this.on_search);
this.basic_composer = new composer.BasicComposer(this, {mention_partners_restricted: true});
@@ -15,7 +15,6 @@ var _lt = core._lt;
var SalesTeamDashboardView = KanbanView.extend({
display_name: _lt('Dashboard'),
icon: 'fa-dashboard',
view_type: "sales_team_dashboard",
searchview_hidden: true,
events: {
'click .o_dashboard_action': 'on_dashboard_action_clicked',