summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2014-04-07 18:17:28 +0200
committerChristophe Simonis <chs@openerp.com>2014-04-07 18:17:28 +0200
commitf1d3f2a0c42f1de5970b5f897c4e5b279d1ee23b (patch)
tree9d5f632e397b7cfcc3bb472cbda371b481558baf /addons/web/static/src
parent0161666e8b6e91da575a96be005cb5f84c64e9cb (diff)
parentffae3807255269ff290bdf9fe62bc668feaade75 (diff)
[MERGE] forward port of branch saas-3 up to revid 3995 chs@openerp.com-20140407144625-jfimvsx4mgrkztqv
bzr revid: chs@openerp.com-20140407161728-ccudwnqo970ac8ay
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css5
-rw-r--r--addons/web/static/src/css/base.sass5
-rw-r--r--addons/web/static/src/js/chrome.js16
-rw-r--r--addons/web/static/src/js/core.js7
-rw-r--r--addons/web/static/src/js/data.js14
-rw-r--r--addons/web/static/src/js/search.js3
-rw-r--r--addons/web/static/src/js/view_form.js13
-rw-r--r--addons/web/static/src/js/view_list.js3
-rw-r--r--addons/web/static/src/js/views.js12
-rw-r--r--addons/web/static/src/xml/base.xml1
10 files changed, 49 insertions, 30 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 66bfaca7c6e..3125d9e938b 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -1284,12 +1284,14 @@
width: 100%;
}
.openerp .oe_view_manager .oe_view_manager_body {
- display: table-row;
height: inherit;
}
.openerp .oe_view_manager .oe_view_manager_view_kanban:not(:empty) {
height: inherit;
}
+.openerp .oe_view_manager[data-view-type=kanban] .oe_view_manager_body {
+ display: table-row;
+}
.openerp .oe_view_manager table.oe_view_manager_header {
border-collapse: separate;
width: 100%;
@@ -2398,6 +2400,7 @@
}
.openerp .oe_hidden_input_file {
position: relative;
+ overflow-x: hidden;
}
.openerp .oe_hidden_input_file input.oe_form_binary_file {
z-index: 0;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index 7110349557a..ca77310b0d9 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -1068,10 +1068,12 @@ $sheet-padding: 16px
height: inherit
width: 100%
.oe_view_manager_body
- display: table-row
height: inherit
.oe_view_manager_view_kanban:not(:empty)
height: inherit
+ &[data-view-type=kanban]
+ .oe_view_manager_body
+ display: table-row
table.oe_view_manager_header
border-collapse: separate
@@ -1951,6 +1953,7 @@ $sheet-padding: 16px
// Position: relative is used for the hidden input[type=file]
// Do not remove it anymore !
position: relative
+ overflow-x: hidden
input.oe_form_binary_file
z-index: 0
line-height: 0
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 8e5df84e2c3..de56927799e 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -105,9 +105,6 @@ instance.web.Dialog = instance.web.Widget.extend({
autoOpen: false,
position: [false, 40],
buttons: null,
- beforeClose: function () {
- self.trigger("closing");
- },
resizeStop: function() {
self.trigger("resized");
},
@@ -208,8 +205,9 @@ instance.web.Dialog = instance.web.Widget.extend({
/**
Closes the popup, if destroy_on_close was passed to the constructor, it is also destroyed.
*/
- close: function() {
+ close: function(reason) {
if (this.dialog_inited && this.$el.is(":data(dialog)")) {
+ this.trigger("closing", reason);
this.$el.dialog('close');
}
},
@@ -225,14 +223,14 @@ instance.web.Dialog = instance.web.Widget.extend({
/**
Destroys the popup, also closes it.
*/
- destroy: function () {
+ destroy: function (reason) {
this.$buttons.remove();
_.each(this.getChildren(), function(el) {
el.destroy();
});
if (! this.__tmp_dialog_closing) {
this.__tmp_dialog_destroying = true;
- this.close();
+ this.close(reason);
this.__tmp_dialog_destroying = undefined;
}
if (this.dialog_inited && !this.isDestroyed() && this.$el.is(":data(dialog)")) {
@@ -256,7 +254,7 @@ instance.web.CrashManager = instance.web.Class.extend({
new (handler)(this, error).display();
return;
}
- if (error.data.name === "openerp.http.SessionExpiredException") {
+ if (error.data.name === "openerp.http.SessionExpiredException" || error.data.name === "werkzeug.exceptions.Forbidden") {
this.show_warning({type: "Session Expired", data: { message: _t("Your OpenERP session expired. Please refresh the current web page.") }});
return;
}
@@ -1264,9 +1262,9 @@ instance.web.WebClient = instance.web.Client.extend({
};
self.action_manager.do_action(result);
var form = self.action_manager.dialog_widget.views.form.controller;
- form.on("on_button_cancel", self.action_manager.dialog, self.action_manager.dialog.close);
+ form.on("on_button_cancel", self.action_manager, self.action_manager.dialog_stop);
form.on('record_saved', self, function() {
- self.action_manager.dialog.close();
+ self.action_manager.dialog_stop();
self.update_logo();
});
});
diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js
index b92ca1d3ba5..90c84ba9cda 100644
--- a/addons/web/static/src/js/core.js
+++ b/addons/web/static/src/js/core.js
@@ -271,7 +271,12 @@ instance.web.Session.include( /** @lends instance.web.Session# */{
for(var i=0; i<cookies.length; ++i) {
var cookie = cookies[i].replace(/^\s*/, '');
if(cookie.indexOf(nameEQ) === 0) {
- return JSON.parse(decodeURIComponent(cookie.substring(nameEQ.length)));
+ try {
+ return JSON.parse(decodeURIComponent(cookie.substring(nameEQ.length)));
+ } catch(err) {
+ // wrong cookie, delete it
+ this.set_cookie(name, '', -1);
+ }
}
}
return null;
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 517afa7f5c2..73f244bc6a3 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -457,9 +457,17 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
return $.Deferred().resolve([]);
options = options || {};
- return this._model.call('read',
- [ids, fields || false],
- {context: this.get_context(options.context)})
+ var method = 'read';
+ var ids_arg = ids;
+ var context = this.get_context(options.context);
+ if (options.check_access_rule === true){
+ method = 'search_read';
+ ids_arg = [['id', 'in', ids]];
+ context = new instance.web.CompoundContext(context, {active_test: false});
+ }
+ return this._model.call(method,
+ [ids_arg, fields || false],
+ {context: context})
.then(function (records) {
if (records.length <= 1) { return records; }
var indexes = {};
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index 7c04ad40149..04bb1a61d99 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -1560,9 +1560,6 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
this.model = new instance.web.Model(this.attrs.relation);
},
complete: function (needle) {
- if (this.attrs.operator || this.attrs.filter_domain) {
- return this._super(needle);
- }
var self = this;
// FIXME: "concurrent" searches (multiple requests, mis-ordered responses)
var context = instance.web.pyeval.eval(
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 7b60957807e..34e5d26c7c2 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -967,9 +967,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
context: {
'bin_size': true,
'future_display_name': true
- }
+ },
+ check_access_rule: true
}).then(function(r) {
self.trigger('load_record', r);
+ }).fail(function (){
+ self.do_action('history_back');
});
}
});
@@ -1990,8 +1993,10 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({
var context = this.build_context();
return this.view.do_execute_action(
_.extend({}, this.node.attrs, {context: context}),
- this.view.dataset, this.view.datarecord.id, function () {
- self.view.recursive_reload();
+ this.view.dataset, this.view.datarecord.id, function (reason) {
+ if (!_.isObject(reason)) {
+ self.view.recursive_reload();
+ }
});
},
check_disable: function() {
@@ -2264,7 +2269,7 @@ instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.Reini
/**
Some hack to make placeholders work in ie9.
*/
-if ($.browser.msie && $.browser.version === "9.0") {
+if (!('placeholder' in document.createElement('input'))) {
document.addEventListener("DOMNodeInserted",function(event){
var nodename = event.target.nodeName.toLowerCase();
if ( nodename === "input" || nodename == "textarea" ) {
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 7426c70838c..cdb9ff8302f 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -537,7 +537,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
[record.get('id')],
_.pluck(_(this.columns).filter(function (r) {
return r.tag === 'field';
- }), 'name')
+ }), 'name'),
+ {check_access_rule: true}
).done(function (records) {
var values = records[0];
if (!values) {
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index c9229c3c70a..2f401445f7e 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -25,9 +25,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
this._super.apply(this, arguments);
this.$el.on('click', 'a.oe_breadcrumb_item', this.on_breadcrumb_clicked);
},
- dialog_stop: function () {
+ dialog_stop: function (reason) {
if (this.dialog) {
- this.dialog.destroy();
+ this.dialog.destroy(reason);
}
this.dialog = null;
},
@@ -408,7 +408,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
if (this.dialog_widget && !this.dialog_widget.isDestroyed()) {
this.dialog_widget.destroy();
}
- this.dialog_stop();
+ this.dialog_stop(executor.action);
this.dialog = new instance.web.Dialog(this, {
dialogClass: executor.klass,
});
@@ -426,7 +426,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
this.dialog.open();
return initialized;
} else {
- this.dialog_stop();
+ this.dialog_stop(executor.action);
this.inner_action = executor.action;
this.inner_widget = widget;
executor.post_process(widget);
@@ -639,7 +639,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
this.$el
.find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]')
.parent().addClass('active');
-
+ this.$el.attr("data-view-type", view_type);
return $.when(view_promise).done(function () {
_.each(_.keys(self.views), function(view_name) {
var controller = self.views[view_name].controller;
@@ -1402,7 +1402,7 @@ instance.web.View = instance.web.Widget.extend({
// Wrong group_by values will simply fail and forbid rendering of the destination view
var ncontext = new instance.web.CompoundContext(
_.object(_.reject(_.pairs(dataset.get_context().eval()), function(pair) {
- return pair[0].match('^(?:(?:default_|search_default_).+|group_by|group_by_no_leaf|active_id|active_ids)$') !== null;
+ return pair[0].match('^(?:(?:default_|search_default_).+|.+_view_ref|group_by|group_by_no_leaf|active_id|active_ids)$') !== null;
}))
);
ncontext.add(action_data.context || {});
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 23cad2098dc..3f7494c75fa 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1264,7 +1264,6 @@
<td>
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
- <t t-set="fileupload_style" t-translation="off">width: 83px;</t>
<button class="oe_button oe_field_button" type="button">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY.png"'/>
<span>Select</span>