diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 4c7259c000d..8bd7950c0ac 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -581,9 +581,11 @@ class Home(http.Controller): redirect = '/web?' + request.httprequest.query_string values['redirect'] = redirect if request.httprequest.method == 'POST': + old_uid = request.uid uid = request.session.authenticate(request.session.db, request.params['login'], request.params['password']) if uid is not False: return http.redirect_with_hash(redirect) + request.uid = old_uid values['error'] = "Wrong login/password" return render_bootstrap_template('web.login', values) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 916e4ffe9ba..3dfdcfa9b64 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "utf-8"; +@charset "UTF-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -720,7 +720,7 @@ border-bottom-left-radius: 8px; } .openerp .oe_notification { - z-index: 1050; + z-index: 1500; } .openerp .oe_webclient_timezone_notification a { color: white; @@ -2742,13 +2742,15 @@ padding: 3px 6px; white-space: pre-line; } -.openerp .oe_list_content > tbody > tr > td > button.btn_img, .openerp .oe_list_content > tbody > tr > th > button.btn_img { +.openerp .oe_list_content > tbody > tr > td > button, .openerp .oe_list_content > tbody > tr > th > button { border: none; background: transparent; padding: 0; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; +} +.openerp .oe_list_content > tbody > tr > td > button.btn_txt, .openerp .oe_list_content > tbody > tr > th > button.btn_txt { + border: 1px solid rgba(0, 0, 0, 0.4); + background: #e3e3e3; + padding: 3px 12px; } .openerp .oe_list_content > tbody > tr > td.oe_list_checkbox:first-child, .openerp .oe_list_content > tbody > tr th.oe_list_checkbox:first-child { width: 17px; @@ -3293,11 +3295,6 @@ body.oe_single_form .oe_single_form_container { overflow: hidden !important; } } -.ui-icon { - width: 18px; - height: 18px; -} - .tooltip { padding: 0; margin: 0; @@ -3307,8 +3304,6 @@ body.oe_single_form .oe_single_form_container { background: white; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); background-color: transparent; - /*We need a greater z-index in order for tooltip to go over bootstrap modal z-index*/ - z-index: 1500; } .tooltip .tooltip-inner { text-align: left !important; @@ -3345,6 +3340,12 @@ body.oe_single_form .oe_single_form_container { .tooltip .tooltip-inner .oe_tooltip_message { max-width: 310px; } + +.ui-icon { + width: 18px; + height: 18px; +} + .modal .modal-header button.close { border: none; background: none; @@ -3355,12 +3356,17 @@ body.oe_single_form .oe_single_form_container { .modal .modal-footer { text-align: left; } -.modal .oe_act_window.modal-body{ - padding: 0; -} -.modal .oe_button{ +.modal .oe_button { margin: 0 4px 0 0; } +.modal .oe_act_window.modal-body { + padding: 0; +} + +.ui-datepicker { + z-index: 1500 !important; +} + input[type="radio"], input[type="checkbox"] { margin-right: 4px; margin-left: 4px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index d83b09bc897..0bf8fcd5285 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -639,7 +639,8 @@ $sheet-padding: 16px // }}} // Notifications {{{ .oe_notification - z-index: 1050 + z-index: 1500 + .oe_webclient_timezone_notification a color: white @@ -2220,11 +2221,14 @@ $sheet-padding: 16px padding: 3px 6px white-space: pre-line > td, > th - > button.btn_img + > button border: none background: transparent padding: 0 - @include box-shadow(none) + > button.btn_txt + border: 1px solid rgba(0,0,0,0.4) + background: #e3e3e3 + padding: 3px 12px > td.oe_list_checkbox:first-child, th.oe_list_checkbox:first-child width: 17px &:after @@ -2736,6 +2740,9 @@ body.oe_single_form .oe_act_window.modal-body padding: 0 +.ui-datepicker + z-index: 1500 !important + input[type="radio"], input[type="checkbox"] margin-right: 4px margin-left: 4px diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js index 2de933f45e8..2f7ff81d089 100644 --- a/addons/web/static/src/js/data_export.js +++ b/addons/web/static/src/js/data_export.js @@ -32,7 +32,7 @@ instance.web.DataExport = instance.web.Dialog.extend({ var self = this; var options = { buttons: [ - {text: _t("Close"), click: function () { self.close(); }}, + {text: _t("Close"), click: function () { self.$el.parents('.modal').modal('hide'); }}, {text: _t("Export To File"), click: function () { self.on_click_export_data(); }} ], close: function () { self.close();} diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 04bb1a61d99..832faa4ca62 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -29,8 +29,8 @@ my.Facet = B.Model.extend({ B.Model.prototype.initialize.apply(this, arguments); this.values = new my.FacetValues(values || []); - this.values.on('add remove change reset', function () { - this.trigger('change', this); + this.values.on('add remove change reset', function (_, options) { + this.trigger('change', this, options); }, this); }, get: function (key) { @@ -399,7 +399,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.setup_global_completion(); this.query = new my.SearchQuery() .on('add change reset remove', this.proxy('do_search')) - .on('add change reset remove', this.proxy('renderFacets')); + .on('change', this.proxy('renderChangedFacets')) + .on('add reset remove', this.proxy('renderFacets')); if (this.options.hidden) { this.$el.hide(); @@ -578,14 +579,20 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea .trigger('blur'); }, /** - * - * @param {openerp.web.search.SearchQuery | openerp.web.search.Facet} _1 - * @param {openerp.web.search.Facet} [_2] + * Call the renderFacets method with the correct arguments. + * This is due to the fact that change events are called with two arguments + * (model, options) while add, reset and remove events are called with + * (collection, model, options) as arguments + */ + renderChangedFacets: function (model, options) { + this.renderFacets(undefined, model, options); + }, + /** + * @param {openerp.web.search.SearchQuery | undefined} Undefined if event is change + * @param {openerp.web.search.Facet} * @param {Object} [options] */ - renderFacets: function (_1, _2, options) { - // _1: model if event=change, otherwise collection - // _2: undefined if event=change, otherwise model + renderFacets: function (collection, model, options) { var self = this; var started = []; var $e = this.$('div.oe_searchview_facets'); @@ -610,6 +617,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea }); $.when.apply(null, started).then(function () { + if (options && options.focus_input === false) return; var input_to_focus; // options.at: facet inserted at given index, focus next input // otherwise just focus last input @@ -618,7 +626,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea } else { input_to_focus = self.input_subviews[(options.at + 1) * 2]; } - input_to_focus.$el.focus(); }); }, @@ -1602,8 +1609,11 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({ return facetValue.get('label'); }, make_domain: function (name, operator, facetValue) { - if (operator === this.default_operator) { + switch(operator){ + case this.default_operator: return [[name, '=', facetValue.get('value')]]; + case 'child_of': + return [[name, 'child_of', facetValue.get('value')]]; } return this._super(name, operator, facetValue); }, diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e14d60747ed..5160f37c374 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3489,7 +3489,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc self.display_value_backup = {}; self.render_value(); self.focus(); - self.view.do_onchange(self); + self.trigger('changed_value'); }); }); }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 49c40579f27..f7a4c5cb295 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -40,7 +40,7 @@ - @@ -800,12 +800,11 @@ + t-att-class="disabled ? 'oe_list_button_disabled btn_txt oe_link' : 'btn_txt oe_link'" + > diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index db880a119ba..4bbe3bcb516 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -196,6 +196,13 @@ openerp.web_calendar = function(instance) { } else { this.avatar_title = attrs.avatar_title; } + + if (isNullOrUndef(attrs.avatar_filter)) { + this.avatar_filter = this.avatar_model; + } else { + this.avatar_filter = attrs.avatar_filter; + } + this.color_field = attrs.color; if (this.color_field && this.selected_filters.length === 0) { @@ -577,7 +584,7 @@ openerp.web_calendar = function(instance) { if (!self.colorIsAttendee || the_attendee_people != temp_ret[self.color_field]) { tempColor = (self.all_filters[the_attendee_people] !== undefined) ? self.all_filters[the_attendee_people].color - : self.all_filters[-1].color; + : (self.all_filters[-1] ? self.all_filters[-1].color : 1); the_title_avatar += ''; }//else don't add myself } @@ -700,7 +707,6 @@ openerp.web_calendar = function(instance) { } if (!self.useContacts) { // If we use all peoples displayed in the current month as filter in sidebars - var filter_value; var filter_item; @@ -713,7 +719,7 @@ openerp.web_calendar = function(instance) { value: filter_value, label: e[self.color_field][1], color: self.get_color(filter_value), - avatar_model: self.avatar_model, + avatar_model: (_.str.toBoolElse(self.avatar_filter, true) ? self.avatar_filter : false ), is_checked: true }; self.all_filters[e[self.color_field][0]] = filter_item; @@ -734,7 +740,7 @@ openerp.web_calendar = function(instance) { return null; }); } - return self.perform_necessary_name_gets(events).then(callback); + } else { //WE USE CONTACT if (self.attendee_people !== undefined) { @@ -751,25 +757,27 @@ openerp.web_calendar = function(instance) { } } - var all_attendees = $.map(events, function (e) { return e[self.attendee_people]; }); - all_attendees = _.chain(all_attendees).flatten().uniq().value(); + + } - self.all_attendees = {}; - if (self.avatar_title !== null) { - new instance.web.Model(self.avatar_title).query(["name"]).filter([["id", "in", all_attendees]]).all().then(function(result) { - _.each(result, function(item) { - self.all_attendees[item.id] = item.name; - }); - }).done(function() { - return self.perform_necessary_name_gets(events).then(callback); - }); - } - else { - _.each(all_attendees,function(item){ - self.all_attendees[item] = ''; + var all_attendees = $.map(events, function (e) { return e[self.attendee_people]; }); + all_attendees = _.chain(all_attendees).flatten().uniq().value(); + + self.all_attendees = {}; + if (self.avatar_title !== null) { + new instance.web.Model(self.avatar_title).query(["name"]).filter([["id", "in", all_attendees]]).all().then(function(result) { + _.each(result, function(item) { + self.all_attendees[item.id] = item.name; }); + }).done(function() { return self.perform_necessary_name_gets(events).then(callback); - } + }); + } + else { + _.each(all_attendees,function(item){ + self.all_attendees[item] = ''; + }); + return self.perform_necessary_name_gets(events).then(callback); } }); }, diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 25a1f932cc4..e4e074b2e7f 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -167,7 +167,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ row_search_facet = query.findWhere({category:'GroupBy'}); if (row_search_facet) { - row_search_facet.values.reset(row_facet.values); + row_search_facet.values.reset(row_facet.values, {focus_input:false}); } else { if (row_groupby.length) { query.add(row_facet); @@ -181,7 +181,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ col_search_facet = query.findWhere({category:'ColGroupBy'}); if (col_search_facet) { - col_search_facet.values.reset(col_facet.values); + col_search_facet.values.reset(col_facet.values, {focus_input:false}); } else { if (col_groupby.length) { query.add(col_facet); diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js index ce73a0b51c6..9946e149d96 100644 --- a/addons/web_graph/static/src/js/graph_widget.js +++ b/addons/web_graph/static/src/js/graph_widget.js @@ -51,7 +51,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ this.search_view = parent.searchview; openerp.session.rpc('/web_graph/check_xlwt').then(function (result) { - self.$('.graph_options_selection label').toggle(result); + self.$('.graph_options_selection label').last().toggle(result); }); return this.model.call('fields_get', []).then(function (f) { @@ -296,11 +296,11 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ if (header.expanded) { this.fold(header); return; - } + } if (header.path.length < header.root.groupby.length) { this.expand(id); return; - } + } if (!this.important_fields.length) { return; } @@ -499,10 +499,12 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ // Main display method // ---------------------------------------------------------------------- display_data: function () { + var scroll = $(window).scrollTop(); this.$('.graph_main_content svg').remove(); this.$('.graph_main_content div').remove(); this.table.empty(); this.table.toggleClass('heatmap', this.heatmap_mode !== 'none'); + this.$('.graph_options_selection label').last().toggleClass('disabled', this.pivot.no_data); this.width = this.$el.width(); this.height = Math.min(Math.max(document.documentElement.clientHeight - 116 - 60, 250), Math.round(0.8*this.$el.width())); @@ -512,6 +514,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ } else { if (this.mode === 'pivot') { this.draw_table(); + $(window).scrollTop(scroll); } else { this.$('.graph_main_content').append($('
')); this.svg = this.$('.graph_main_content svg')[0]; @@ -626,7 +629,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ if ((dim_x === 0) && (dim_y === 0)) { data = [{key: _t('Total'), values:[{ x: _t('Total'), - y: this.pivot.get_total(), + y: this.pivot.get_total()[0], }]}]; // Only column groupbys } else if ((dim_x === 0) && (dim_y >= 1)){ @@ -639,7 +642,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ // Just 1 row groupby } else if ((dim_x === 1) && (dim_y === 0)) { data = _.map(this.pivot.main_row().children, function (pt) { - var value = self.pivot.get_total(pt), + var value = self.pivot.get_total(pt)[0], title = (pt.title !== undefined) ? pt.title : _t('Undefined'); return {x: title, y: value}; }); @@ -676,8 +679,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ nv.addGraph(function () { var chart = nv.models.multiBarChart() - .width(self.width) - .height(self.height) .reduceXTicks(false) .stacked(self.bar_ui === 'stack') .showControls(show_controls); @@ -705,9 +706,12 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ dim_x = this.pivot.rows.groupby.length, dim_y = this.pivot.cols.groupby.length; + var rows = this.pivot.get_rows_with_depth(dim_x), + labels = _.pluck(rows, 'title'); + var data = _.map(this.pivot.get_cols_leaves(), function (col) { - var values = _.map(self.pivot.get_rows_with_depth(dim_x), function (row) { - return {x: row.title, y: self.pivot.get_values(row.id,col.id)[0] || 0}; + var values = _.map(rows, function (row, index) { + return {x: index, y: self.pivot.get_values(row.id,col.id)[0] || 0}; }); var title = _.map(col.path, function (p) { return p || _t('Undefined'); @@ -720,10 +724,9 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ nv.addGraph(function () { var chart = nv.models.lineChart() - .x(function (d,u) { return u; }) - .width(self.width) - .height(self.height) - .margin({top: 30, right: 20, bottom: 20, left: 60}); + .x(function (d,u) { return u; }); + + chart.xAxis.tickFormat(function (d,u) {return labels[d];}); d3.select(self.svg) .attr('width', self.width) @@ -745,14 +748,14 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ if (dim_x === 0) { title = self.measure_label; } - return {x: title, y: self.pivot.get_total(row)}; + return {x: title, y: self.pivot.get_total(row)[0]}; }); nv.addGraph(function () { var chart = nv.models.pieChart() - .color(d3.scale.category10().range()) .width(self.width) - .height(self.height); + .height(self.height) + .color(d3.scale.category10().range()); d3.select(self.svg) .datum(data) diff --git a/addons/web_graph/static/src/js/pivot_table.js b/addons/web_graph/static/src/js/pivot_table.js index 6b12829982e..48ae9ec3830 100644 --- a/addons/web_graph/static/src/js/pivot_table.js +++ b/addons/web_graph/static/src/js/pivot_table.js @@ -14,6 +14,7 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ this.cells = []; this.domain = domain; this.no_data = true; + this.updating = false; this.model = model; this.fields = fields; this.fields.__count = {type: 'integer', string:_t('Quantity')}; @@ -55,6 +56,13 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ }, set: function (domain, row_groupby, col_groupby) { + var self = this; + if (this.updating) { + return this.updating.then(function () { + self.updating = false; + return self.set(domain, row_groupby,col_groupby); + }); + } var row_gb_changed = !_.isEqual(row_groupby, this.rows.groupby), col_gb_changed = !_.isEqual(col_groupby, this.cols.groupby); @@ -251,7 +259,7 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ // to null before calling update_data. update_data: function () { var self = this; - return this.perform_requests().then (function () { + this.updating = this.perform_requests().then (function () { var data = Array.prototype.slice.call(arguments); self.no_data = !data[0].length; if (self.no_data) { @@ -273,6 +281,7 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ self.set_headers(row_headers, self.rows); self.set_headers(col_headers, self.cols); }); + return this.updating; }, make_headers_and_cell: function (data_pts, row_headers, col_headers, index, prefix, expand) {