Skip to content

Commit

Permalink
[IMP] web: hide group by option in search view for calendar view
Browse files Browse the repository at this point in the history
  • Loading branch information
ppr-odoo authored and Ravi Gadhia committed Oct 16, 2017
1 parent 320fd28 commit 69df0a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addons/web/static/src/js/chrome/control_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var ControlPanel = Widget.extend({
this._attach_content(new_cp_content);

// Update the searchview and switch buttons
this._update_search_view(status.searchview, status.search_view_hidden);
this._update_search_view(status.searchview, status.search_view_hidden, status.groupby_disable);
if (status.active_view_selector) {
this._update_switch_buttons(status.active_view_selector);
}
Expand Down Expand Up @@ -261,12 +261,15 @@ var ControlPanel = Widget.extend({
* @param {openerp.web.SearchView} [searchview] the searchview Widget
* @param {Boolean} [is_hidden] visibility of the searchview
*/
_update_search_view: function(searchview, is_hidden) {
_update_search_view: function (searchview, is_hidden, groupby_disable) {
if (searchview) {
// Set the $buttons div (in the DOM) of the searchview as the $buttons
// have been appended to a jQuery node not in the DOM at SearchView initialization
searchview.$buttons = this.nodes.$searchview_buttons;
searchview.toggle_visibility(!is_hidden);
if (!searchview.options.disable_groupby){
groupby_disable ? searchview.groupby_menu.do_hide() : searchview.groupby_menu.do_show();
}
}

this.nodes.$searchview.toggle(!is_hidden);
Expand Down
2 changes: 2 additions & 0 deletions addons/web/static/src/js/chrome/view_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
groupBy: actionGroupBy,
}, self.flags, self.flags[view_type], view.options),
searchable: View.prototype.searchable,
groupby_disable: View.prototype.groupby_disable,
title: self.title,
type: view_type,
view_id: view[0] || view.view_id,
Expand Down Expand Up @@ -327,6 +328,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
hidden: this.flags.headless,
searchview: this.searchview,
search_view_hidden: !this.active_view.searchable || this.active_view.searchview_hidden,
groupby_disable: this.active_view.groupby_disable
};
this.update_control_panel(cp_status);

Expand Down
2 changes: 2 additions & 0 deletions addons/web/static/src/js/views/abstract_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ var AbstractView = Class.extend({
// views are the form view and the diagram view.
searchable: true,

// desable groupby option in search view.
groupby_disable: false,
config: {
Model: AbstractModel,
Renderer: AbstractRenderer,
Expand Down
1 change: 1 addition & 0 deletions addons/web/static/src/js/views/calendar/calendar_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var CalendarView = AbstractView.extend({
Controller: CalendarController,
Renderer: CalendarRenderer,
},
groupby_disable: true,
init: function (viewInfo, params) {
this._super.apply(this, arguments);
var arch = viewInfo.arch;
Expand Down

0 comments on commit 69df0a3

Please sign in to comment.