[IMP] some cleanups in graph/kanban views
authorGéry Debongnie <ged@odoo.com>
Tue, 7 Oct 2014 14:41:39 +0000 (16:41 +0200)
committerGéry Debongnie <ged@odoo.com>
Tue, 21 Oct 2014 07:33:51 +0000 (09:33 +0200)
notable: disable the group by integration in graph view, because of crash (the search view was rewritten and too much search logic was in the graph view.  This is a temporary measure, the graph view will be split into pivot/graph views, and the search integration will be done correctly in the near future.

addons/web_graph/static/src/js/graph_view.js
addons/web_graph/static/src/js/graph_widget.js
addons/web_kanban/static/src/js/kanban.js
addons/web_kanban/static/src/xml/web_kanban.xml

index dd4ba80..9242962 100644 (file)
@@ -114,12 +114,8 @@ instance.web_graph.GraphView = instance.web.View.extend({
                 this.widget_config.measures = measures;
             }
             this.graph_widget = new openerp.web_graph.Graph(this, this.model, domain, this.widget_config);
-            this.graph_widget.appendTo(this.$el);
-            this.ViewManager.on('switch_mode', this, function (e) {
-                if (e === 'graph') {
-                    var group_bys = self.get_groupbys_from_searchview();
-                    this.graph_widget.set(domain, group_bys.group_by, group_bys.col_group_by, group_bys.measures);
-                }
+            this.graph_widget.appendTo(this.$el).done(function () {
+
             });
             return;
         }
@@ -226,7 +222,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
         return {
             category:'GroupBy',
             values: this.make_groupby_values(groupbys, 'group_by'),
-            icon:'w',
+            icon:'fa fa-bars',
             field: this.search_view._s_groupby
         };
     },
@@ -235,7 +231,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
         return {
             category:'ColGroupBy',
             values: this.make_groupby_values(groupbys, 'col_group_by'),
-            icon:'f',
+            icon:'fa fa-bars fa-rotate-90',
             field: this.col_search_field
         };
     },
index fc1ed4a..ffdcd4c 100644 (file)
@@ -122,6 +122,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
     // this method gets the fields that appear in the search view, under the 
     // 'Groupby' heading
     get_search_fields: function () {
+        return [];
         var self = this;
 
         var groupbygroups = _(this.search_view.drawer.inputs).select(function (g) {
index c5af443..0f9b215 100644 (file)
@@ -43,6 +43,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
         this.currently_dragging = {};
         this.limit = options.limit || 40;
         this.add_group_mutex = new $.Mutex();
+        if (!this.options.$buttons.length) {
+            this.options.$buttons = false;
+        }
     },
     view_loading: function(r) {
         return this.load_kanban(r);
@@ -69,13 +72,12 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
         if (unsorted && default_order) {
             this.dataset.set_sort(default_order.split(','));
         }
-
         this.$el.addClass(this.fields_view.arch.attrs['class']);
         this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this}));
         if (this.options.$buttons) {
             this.$buttons.appendTo(this.options.$buttons);
         } else {
-            this.$el.find('.oe_kanban_buttons').replaceWith(this.$buttons);
+            this.$('.oe_kanban_buttons').replaceWith(this.$buttons);
         }
         this.$buttons
             .on('click', 'button.oe_kanban_button_new', this.do_add_record)
@@ -490,7 +492,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
     },
 
     do_show: function() {
-        if (this.$buttons) {
+        if (this.options.$buttons) {
             this.$buttons.show();
         }
         this.do_push_state({});
index 8a46800..8c6ff90 100644 (file)
@@ -15,7 +15,7 @@
 <div t-name="KanbanView.buttons" class="oe_kanban_buttons">
     <t t-if="widget.options.action_buttons !== false">
         <t t-if="widget.is_action_enabled('create')">
-            <button type="button" class="oe_kanban_button_new btn btn-primary">
+            <button type="button" class="oe_kanban_button_new btn btn-primary btn-sm">
                 <t t-esc="widget.options.create_text || _t('Create')"/>
             </button>
             <span t-if="widget.is_action_enabled('group_create')" class="oe_alternative" style="display: none">