diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-03-26 09:47:36 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 3deac18485876965a47efe9f742758ab525abcd9 (patch) | |
| tree | 4e54ed260e0d8b51198630a9cb18626402c4a8a1 /addons/web/static/src/js | |
| parent | 6016369b30b3b0674d104ef81038add4dd8b2853 (diff) | |
[REF] board: update dashboards to new js framework
With the new views, we totally broke the dashboard. This commit
rewrites all the code to comply with our new coding guidelines, and make
sure it works, with some tests.
Note that a big change is that we don't instantiate an action manager
and a view manager, we directly instantiate the views.
Also, this is not the best way to organize the dashboard. I think that
it should be a client action, not a form view, so we don't have to
overload all the form view classes and we don't depend on form view
behaviour/view caches/...
Diffstat (limited to 'addons/web/static/src/js')
7 files changed, 7 insertions, 6 deletions
diff --git a/addons/web/static/src/js/chrome/search_menus.js b/addons/web/static/src/js/chrome/search_menus.js index 7eff17d7ed6..fdbac7b5eef 100644 --- a/addons/web/static/src/js/chrome/search_menus.js +++ b/addons/web/static/src/js/chrome/search_menus.js @@ -23,7 +23,7 @@ return Widget.extend({ this.toggle_save_menu(); }, 'click .o_save_name button': 'save_favorite', - 'hidden.bs.dropdown': 'close_menus', + 'hidden.bs.dropdown': '_closeMenus', 'keyup .o_save_name input': function (ev) { if (ev.which === $.ui.keyCode.ENTER) { this.save_favorite(); @@ -74,7 +74,7 @@ return Widget.extend({ this.$save_name.find('input').first().focus(); } }, - close_menus: function () { + _closeMenus: function () { this.toggle_save_menu(false); }, save_favorite: function () { diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js index d321c3f3e64..252b8379565 100644 --- a/addons/web/static/src/js/views/abstract_controller.js +++ b/addons/web/static/src/js/views/abstract_controller.js @@ -277,11 +277,13 @@ var AbstractController = Widget.extend({ * @param {string} [event.data.mode='readonly'] */ _onOpenRecord: function (event) { + event.stopPropagation(); var record = this.model.get(event.data.id, {raw: true}); this.trigger_up('switch_view', { view_type: 'form', res_id: record.res_id, mode: event.data.mode || 'readonly', + model: this.modelName, }); }, diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js index 56465eba3b8..052072327b2 100644 --- a/addons/web/static/src/js/views/form/form_controller.js +++ b/addons/web/static/src/js/views/form/form_controller.js @@ -11,7 +11,6 @@ var _t = core._t; var qweb = core.qweb; var FormController = BasicController.extend({ - // className: "o_form_view", custom_events: _.extend({}, BasicController.prototype.custom_events, { open_one2many_record: '_onOpenOne2ManyRecord', bounce_edit: '_onBounceEdit', diff --git a/addons/web/static/src/js/views/form/form_view.js b/addons/web/static/src/js/views/form/form_view.js index 88de1f4029b..423ed08085c 100644 --- a/addons/web/static/src/js/views/form/form_view.js +++ b/addons/web/static/src/js/views/form/form_view.js @@ -32,7 +32,7 @@ var FormView = BasicView.extend({ this.controllerParams.hasSidebar = params.sidebar; this.controllerParams.toolbar = false; this.controllerParams.footerToButtons = params.footer_to_buttons; - if ('action' in params) { + if ('action' in params && 'flags' in params.action) { this.controllerParams.footerToButtons = params.action.flags.footer_to_buttons; } var defaultButtons = 'default_buttons' in params ? params.default_buttons : true; diff --git a/addons/web/static/src/js/views/kanban/kanban_model.js b/addons/web/static/src/js/views/kanban/kanban_model.js index ff8b357a6ac..7dc2f0cbfa3 100644 --- a/addons/web/static/src/js/views/kanban/kanban_model.js +++ b/addons/web/static/src/js/views/kanban/kanban_model.js @@ -85,7 +85,7 @@ var KanbanModel = BasicModel.extend({ */ load: function (params) { this.defaultGroupedBy = params.groupBy; - params.groupedBy = params.groupedBy.length ? params.groupedBy : this.defaultGroupedBy; + params.groupedBy = (params.groupedBy && params.groupedBy.length) ? params.groupedBy : this.defaultGroupedBy; return this._super(params); }, /** diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index aec9d1bf70d..50bb74334c4 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -323,6 +323,7 @@ var ListController = BasicController.extend({ * @param {OdooEvent} event */ _onToggleColumnOrder: function (event) { + event.stopPropagation(); var data = this.model.get(this.handle); if (!data.groupedBy) { this.pager.updateState({current_min: 1}); diff --git a/addons/web/static/src/js/views/list/list_view.js b/addons/web/static/src/js/views/list/list_view.js index 4ec16ef35f4..5661d3cf4f8 100644 --- a/addons/web/static/src/js/views/list/list_view.js +++ b/addons/web/static/src/js/views/list/list_view.js @@ -38,7 +38,6 @@ var ListView = BasicView.extend({ var arch = viewInfo.arch; this.controllerParams.editable = arch.attrs.editable; this.controllerParams.hasSidebar = params.sidebar; - this.controllerParams.noContentHelp = params.action && params.action.help; this.controllerParams.activeActions.delete = true; this.controllerParams.noLeaf = !!this.loadParams.context.group_by_no_leaf; |
