summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-01-27 12:24:04 +0100
committerChristophe Simonis <chs@odoo.com>2016-01-27 12:24:04 +0100
commit78d20b552b4374b94aec7097c0e6a48a3dd2d961 (patch)
tree5acd7cbf1cc9e2f277034f44fc0ebebaa3a1a79c /addons/web/static/src
parent740a6eadd379cc3fa26aefb9350f1c95b3e05ebd (diff)
parent7e44ddcda3f21c7e6401173539dc0fe93f9a7dd2 (diff)
[MERGE] forward port of branch saas-8 up to 7e44ddc
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css1
-rw-r--r--addons/web/static/src/css/base.sass1
-rw-r--r--addons/web/static/src/js/action_manager.js13
-rw-r--r--addons/web/static/src/js/framework/utils.js18
-rw-r--r--addons/web/static/src/js/view_manager.js23
-rw-r--r--addons/web/static/src/js/views/form_relational_widgets.js3
-rw-r--r--addons/web/static/src/js/views/form_widgets.js15
-rw-r--r--addons/web/static/src/js/views/pivot_view.js10
-rw-r--r--addons/web/static/src/js/widgets/debug_manager.js13
-rw-r--r--addons/web/static/src/less/utils.less2
-rw-r--r--addons/web/static/src/xml/base.xml6
11 files changed, 70 insertions, 35 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index b8f5a998cd7..fddbbe25800 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -2831,6 +2831,7 @@ body.oe_single_form .oe_single_form_container {
}
.openerp .oe-view-manager {
display: block;
+ overflow: visible;
}
.openerp .oe_application, .openerp .oe_view_manager_wrapper {
height: auto !important;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index eee7739b3f6..f82d77c624c 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -2413,6 +2413,7 @@ body.oe_single_form
height: auto !important
.oe-view-manager
display: block
+ overflow: visible
.oe_application, .oe_view_manager_wrapper
height: auto !important
.oe_application > div > .oe_view_manager > .oe_view_manager_wrapper > div > .oe_view_manager_body
diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js
index ec3441eee4c..2337583b7f9 100644
--- a/addons/web/static/src/js/action_manager.js
+++ b/addons/web/static/src/js/action_manager.js
@@ -228,9 +228,9 @@ var ActionManager = Widget.extend({
this.main_control_panel = new ControlPanel(this);
// Listen to event "on_breadcrumb_click" trigerred on the control panel when
// clicking on a part of the breadcrumbs. Call select_action for this breadcrumb.
- this.main_control_panel.on("on_breadcrumb_click", this, function(action, index) {
+ this.main_control_panel.on("on_breadcrumb_click", this, _.debounce(function(action, index) {
this.select_action(action, index);
- });
+ }, 200, true));
// Append the main control panel to the DOM (inside the ActionManager jQuery element)
this.main_control_panel.appendTo(this.$el);
@@ -788,10 +788,15 @@ var ActionManager = Widget.extend({
});
},
ir_actions_act_url: function (action) {
+ var url = action.url;
+ if (session.debug && url && url.length && url[0] === '/') {
+ url = $.param.querystring(url, 'debug');
+ }
+
if (action.target === 'self') {
- framework.redirect(action.url);
+ framework.redirect(url);
} else {
- window.open(action.url, '_blank');
+ window.open(url, '_blank');
}
return $.when();
},
diff --git a/addons/web/static/src/js/framework/utils.js b/addons/web/static/src/js/framework/utils.js
index 087d4c73d65..a0ab37a7dfb 100644
--- a/addons/web/static/src/js/framework/utils.js
+++ b/addons/web/static/src/js/framework/utils.js
@@ -411,6 +411,13 @@ var DropMisordered = Class.extend({
},
});
+function swap(array, elem1, elem2) {
+ var i1 = array.indexOf(elem1);
+ var i2 = array.indexOf(elem2);
+ array[i2] = elem1;
+ array[i1] = elem2;
+}
+
return {
divmod: divmod,
@@ -437,6 +444,7 @@ return {
assert: assert,
xor: xor,
DropMisordered: DropMisordered,
+ swap: swap,
};
});
@@ -467,10 +475,16 @@ function autoresize ($textarea, options) {
top: -10000,
left: -10000,
});
- $fixed_text_area.addClass($fixed_text_area[0].classList);
+ $fixed_text_area.addClass($textarea[0].className);
$fixed_text_area.insertAfter($textarea);
}
+ var style = window.getComputedStyle($textarea[0], null);
+ if (style.resize === 'vertical') {
+ $textarea[0].style.resize = 'none';
+ } else if (style.resize === 'both') {
+ $textarea[0].style.resize = 'horizontal';
+ }
resize();
if ($textarea.__auto_resized) {
return;
@@ -491,7 +505,7 @@ function autoresize ($textarea, options) {
} else {
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
- $fixed_text_area.width($textarea.outerWidth());
+ $fixed_text_area.width($textarea.width());
$fixed_text_area.val($textarea.val());
var height = $fixed_text_area[0].scrollHeight;
$textarea.css({height: Math.max(height + heightOffset, min_height)});
diff --git a/addons/web/static/src/js/view_manager.js b/addons/web/static/src/js/view_manager.js
index c5db4b954ca..2ae53aabb22 100644
--- a/addons/web/static/src/js/view_manager.js
+++ b/addons/web/static/src/js/view_manager.js
@@ -130,8 +130,10 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
var view = this.views[view_type];
var old_view = this.active_view;
- if (!view) {
+ if (!view || this.currently_switching) {
return $.Deferred().reject();
+ } else {
+ this.currently_switching = true; // prevent overlapping switches
}
if (view.multi_record) {
@@ -156,11 +158,23 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
self.searchview.do_search();
});
}
- return $.when(view.created, this.active_search).then(function () {
+ var switched = $.when(view.created, this.active_search).then(function () {
return self._display_view(view_options, old_view).then(function () {
self.trigger('switch_mode', view_type, no_store, view_options);
});
});
+ switched.fail(function(e) {
+ if (!(e && e.code === 200 && e.data.exception_type)) {
+ self.do_warn(_t("Error"), view.controller.display_name + _t(" view couldn't be loaded"));
+ }
+ // Restore internal state
+ self.active_view = old_view;
+ self.view_stack.pop();
+ });
+ switched.always(function () {
+ self.currently_switching = false;
+ });
+ return switched;
},
_display_view: function (view_options, old_view) {
var self = this;
@@ -239,7 +253,6 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
},
select_view: function (index) {
var view_type = this.view_stack[index].type;
- this.view_stack.splice(index);
return this.switch_mode(view_type);
},
/**
@@ -262,10 +275,10 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
});
// Add onclick event listener
- this.control_elements.$switch_buttons.siblings('button').click(function(event) {
+ this.control_elements.$switch_buttons.siblings('button').click(_.debounce(function(event) {
var view_type = $(event.target).data('view-type');
self.switch_mode(view_type);
- });
+ }, 200, true));
}
},
/**
diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js
index 66330006380..600751b8b83 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -1160,6 +1160,9 @@ var One2ManyListView = X2ManyListView.extend({
return this._super();
},
_on_focus_one2many: function () {
+ if(!this.editor.is_editing()) {
+ return;
+ }
this.dataset.x2m.internal_dataset_changed = true;
this._dataset_changed = false;
this.__focus = true;
diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js
index 96107503a5f..0f89396eed2 100644
--- a/addons/web/static/src/js/views/form_widgets.js
+++ b/addons/web/static/src/js/views/form_widgets.js
@@ -81,7 +81,6 @@ var WidgetButton = common.FormWidget.extend({
},
on_confirmed: function() {
var self = this;
-
var context = this.build_context();
return this.view.do_execute_action(
_.extend({}, this.node.attrs, {context: context}),
@@ -89,6 +88,8 @@ var WidgetButton = common.FormWidget.extend({
if (!_.isObject(reason)) {
self.view.recursive_reload();
}
+ }).fail(function () {
+ self.view.recursive_reload();
});
},
check_disable: function() {
@@ -438,12 +439,12 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin,
var domain = pyeval.eval('domain', this.get('value'));
var ds = new data.DataSetStatic(self, model, self.build_context());
ds.call('search_count', [domain]).then(function (results) {
- self.$('.o_count').text(results + ' selected records');
+ self.$('.o_count').text(results + _t(' selected records'));
if (self.get('effective_readonly')) {
- self.$('button').text('See selection ');
+ self.$('button').text(_t('See selection '));
}
else {
- self.$('button').text('Change selection ');
+ self.$('button').text(_t('Change selection '));
}
self.$('button').append($("<span/>").addClass('fa fa-arrow-right'));
});
@@ -452,9 +453,9 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin,
this.$('.o_debug_input').val(this.get('value'));
}
} else {
- this.$('.o_count').text('No selected record');
+ this.$('.o_count').text(_t('No selected record'));
var $arrow = this.$('button span').detach();
- this.$('button').text('Select records ').append($("<span/>").addClass('fa fa-arrow-right'));
+ this.$('button').text(_('Select records ')).append($("<span/>").addClass('fa fa-arrow-right'));
}
},
on_click: function(event) {
@@ -464,7 +465,7 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin,
var dialog = new common.DomainEditorDialog(this, {
res_model: this.options.model || this.field_manager.get_field_value(this.options.model_field),
default_domain: this.get('value'),
- title: this.get('effective_readonly') ? 'Selected records' : 'Select records...',
+ title: this.get('effective_readonly') ? _t('Selected records') : _t('Select records...'),
readonly: this.get('effective_readonly'),
disable_multiple_selection: this.get('effective_readonly'),
no_create: this.get('effective_readonly'),
diff --git a/addons/web/static/src/js/views/pivot_view.js b/addons/web/static/src/js/views/pivot_view.js
index deb2c16870f..6d0a75da569 100644
--- a/addons/web/static/src/js/views/pivot_view.js
+++ b/addons/web/static/src/js/views/pivot_view.js
@@ -17,7 +17,6 @@ var View = require('web.View');
var _lt = core._lt;
var _t = core._t;
var QWeb = core.qweb;
-var total = _t("Total");
var PivotView = View.extend({
template: 'PivotView',
@@ -184,7 +183,7 @@ var PivotView = View.extend({
}
}
});
- this.measures.__count__ = {string: "Quantity", type: "integer"};
+ this.measures.__count__ = {string: _t("Quantity"), type: "integer"};
},
do_search: function (domain, context, group_by) {
if (!this.ready) {
@@ -509,6 +508,7 @@ var PivotView = View.extend({
return name + (numbers[id] > 1 ? " (" + numbers[id] + ")" : "");
},
make_header: function (data_pt, root, i, j, parent_header) {
+ var total = _t("Total");
var attrs = data_pt.attributes,
value = attrs.value,
title = value.length ? value[value.length - 1] : total;
@@ -537,6 +537,7 @@ var PivotView = View.extend({
},
get_header: function (data_pt, root, i, j, parent) {
var path;
+ var total = _t("Total");
if (parent) {
path = parent.path.concat(data_pt.attributes.value.slice(i,j));
} else {
@@ -798,6 +799,10 @@ var PivotView = View.extend({
nbr_measures: nbr_measures,
title: this.title,
};
+ if(table.measure_row.length + 1 > 256) {
+ c.show_message(_t("For Excel compatibility, data cannot be exported if there is more than 256 columns.\n\nTip: try to flip axis, filter further or reduce the number of measures."));
+ return;
+ }
session.get_file({
url: '/web/pivot/export_xls',
data: {data: JSON.stringify(table)},
@@ -834,4 +839,3 @@ core.view_registry.add('pivot', PivotView);
return PivotView;
});
-
diff --git a/addons/web/static/src/js/widgets/debug_manager.js b/addons/web/static/src/js/widgets/debug_manager.js
index 610dcd7819e..36a3a205632 100644
--- a/addons/web/static/src/js/widgets/debug_manager.js
+++ b/addons/web/static/src/js/widgets/debug_manager.js
@@ -5,6 +5,7 @@ var core = require('web.core');
var Dialog = require('web.Dialog');
var formats = require('web.formats');
var framework = require('web.framework');
+var Model = require('web.Model');
var session = require('web.session');
var SystrayMenu = require('web.SystrayMenu');
var utils = require('web.utils');
@@ -148,15 +149,9 @@ if (core.debug) {
});
},
translate: function() {
- this.do_action({
- name: _t("Technical Translation"),
- res_model : 'ir.translation',
- domain : [['type', '!=', 'object'], '|', ['name', '=', this.dataset.model], ['name', 'ilike', this.dataset.model + ',']],
- views: [[false, 'list'], [false, 'form']],
- type : 'ir.actions.act_window',
- view_type : "list",
- view_mode : "list"
- });
+ new Model("ir.translation")
+ .call('get_technical_translations', [this.dataset.model])
+ .then(this.do_action);
},
edit: function(params, evt) {
this.do_action({
diff --git a/addons/web/static/src/less/utils.less b/addons/web/static/src/less/utils.less
index 9adca6f6679..da69e2c0aa9 100644
--- a/addons/web/static/src/less/utils.less
+++ b/addons/web/static/src/less/utils.less
@@ -189,7 +189,7 @@
// ------------------------------------------------------------------
// Transition
// ------------------------------------------------------------------
-.o-transition(@property: all, @duration: 0s, @timing-function: easy, @transition-delay: 0s) {
+.o-transition(@property: all, @duration: 0s, @timing-function: ease, @transition-delay: 0s) {
-webkit-transition: @property @duration @timing-function @transition-delay;
-moz-transition: @property @duration @timing-function @transition-delay;
-o-transition: @property @duration @timing-function @transition-delay;
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index ce4b04a5a87..a8c24000c6b 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -195,7 +195,7 @@
<t t-name="WebClient.DebugManager">
<li class="oe_debug_manager">
- <a href="#" t-att-title='_t("Open Debug Menu")' class="dropdown-toggle oe_debug_button" data-toggle="dropdown">
+ <a href="#" title="Open Debug Menu" class="dropdown-toggle oe_debug_button" data-toggle="dropdown">
<span class="fa fa-bug"/>
<b class="caret"/>
</a>
@@ -867,13 +867,11 @@
><img t-attf-src="#{prefix}/web/static/src/img/icons/#{widget.icon}.png" t-att-alt="widget.string" width="16" height="16"/>
</t>
<t t-name="FieldMany2ManyTag">
- <t t-set="i" t-value="0"/>
<t t-foreach="elements" t-as="el">
- <span t-attf-class="badge dropdown #{'o_tag_color_' + (el['color'] || 0)}" t-att-data-color="(el['color'] || 0)" t-att-data-index="i" t-att-data-id="el['id']">
+ <span t-attf-class="badge dropdown #{'o_tag_color_' + (el['color'] || 0)}" t-att-data-color="(el['color'] || 0)" t-att-data-index="el_index" t-att-data-id="el['id']">
<t t-esc="el['display_name']"/>
<span t-if="!readonly" class="fa fa-times o_delete"/>
</span>
- <t t-set="i" t-value="i + 1"/>
</t>
</t>
<t t-name="FieldMany2ManyTag.colorpicker">