summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2013-09-24 14:51:03 +0200
committerFabien Meghazi <fme@openerp.com>2013-09-24 14:51:03 +0200
commit3ddeaee79cecc404111192f4181a4247e93207f7 (patch)
treedf8d14ff5903e7d6f6f55d0ffbbb116dbcbd9740 /addons/web/static/src
parent18acfa505abd53d526f3288dbe2a9643d7112077 (diff)
parentbc0d066505a054389525cdf7601b35751ea3efbb (diff)
[MERGE] upstream
bzr revid: fme@openerp.com-20130814164422-l0h0ueue0fwk94uu bzr revid: chm@openerp.com-20130828165815-a901l9gx66lj0pj1 bzr revid: fme@openerp.com-20130924125103-65bngr3rnm6k7u3a
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/chrome.js27
-rw-r--r--addons/web/static/src/js/data.js15
-rw-r--r--addons/web/static/src/js/openerpframework.js2
-rw-r--r--addons/web/static/src/js/search.js2
-rw-r--r--addons/web/static/src/js/view_form.js23
-rw-r--r--addons/web/static/src/js/view_tree.js23
-rw-r--r--addons/web/static/src/xml/base.xml3
9 files changed, 59 insertions, 38 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 0008c763750..97bbb2b207c 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -2204,7 +2204,6 @@
}
.openerp .oe_form header {
position: relative;
- z-index: 1;
border-bottom: 1px solid #cacaca;
padding-left: 2px;
background-color: #ededed;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index baf0b720b60..e41a182407d 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -1748,7 +1748,6 @@ $sheet-padding: 16px
// FormView.header {{{
.oe_form header
position: relative
- z-index: 1
border-bottom: 1px solid #cacaca
padding-left: 2px
@include vertical-gradient(#fcfcfc, #dedede)
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 82cdf46bba8..11a2e58ae5b 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -805,10 +805,11 @@ instance.web.redirect = function(url, wait) {
var load = function() {
var old = "" + window.location;
- if (old === url) {
- window.location.reload();
- } else {
- window.location = url;
+ var old_no_hash = old.split("#")[0];
+ var url_no_hash = url.split("#")[0];
+ location.assign(url);
+ if (old_no_hash === url_no_hash) {
+ location.reload(true);
}
};
@@ -1307,13 +1308,8 @@ instance.web.WebClient = instance.web.Client.extend({
this.on("change:title_part", this, this._title_changed);
this._title_changed();
return $.when(this._super()).then(function() {
- if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
- $("body").addClass("kitten-mode-activated");
- $("body").css("background-image", "url(" + instance.session.origin + "/web/static/src/img/back-enable.jpg" + ")");
- if ($.blockUI) {
- var imgkit = Math.floor(Math.random() * 2 + 1);
- $.blockUI.defaults.message = '<img src="http://www.amigrave.com/loading-kitten/' + imgkit + '.gif" class="loading-kitten">';
- }
+ if (jQuery.deparam !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
+ self.to_kitten();
}
if (!self.session.session_is_valid()) {
self.show_login();
@@ -1322,6 +1318,15 @@ instance.web.WebClient = instance.web.Client.extend({
}
});
},
+ to_kitten: function() {
+ this.kitten = true;
+ $("body").addClass("kitten-mode-activated");
+ $("body").css("background-image", "url(" + instance.session.origin + "/web/static/src/img/back-enable.jpg" + ")");
+ if ($.blockUI) {
+ var imgkit = Math.floor(Math.random() * 2 + 1);
+ $.blockUI.defaults.message = '<img src="http://www.amigrave.com/loading-kitten/' + imgkit + '.gif" class="loading-kitten">';
+ }
+ },
/**
Sets the first part of the title of the window, dedicated to the current action.
*/
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 26807a2ee0f..04f657d91f7 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -61,18 +61,19 @@ instance.web.Query = instance.web.Class.extend({
},
_execute: function () {
var self = this;
- return this._model.call('search_read', {
+ return instance.session.rpc('/web/dataset/search_read', {
+ model: this._model.name,
+ fields: this._fields || false,
domain: instance.web.pyeval.eval('domains',
[this._model.domain(this._filter)]),
- fields: this._fields || false,
- offset: this._offset,
- limit: this._limit,
- order: instance.web.serialize_sort(this._order_by),
context: instance.web.pyeval.eval('contexts',
[this._model.context(this._context)]),
+ offset: this._offset,
+ limit: this._limit,
+ sort: instance.web.serialize_sort(this._order_by)
}).then(function (results) {
self._count = results.length;
- return results;
+ return results.records;
}, null);
},
/**
@@ -450,7 +451,7 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
// TODO: reorder results to match ids list
return this._model.call('read',
[ids, fields || false],
- {context: this._model.context(options.context)});
+ {context: this.get_context(options.context)});
},
/**
* Read a slice of the records represented by this DataSet, based on its
diff --git a/addons/web/static/src/js/openerpframework.js b/addons/web/static/src/js/openerpframework.js
index 2a4bcc50ffd..027452b42fb 100644
--- a/addons/web/static/src/js/openerpframework.js
+++ b/addons/web/static/src/js/openerpframework.js
@@ -761,6 +761,8 @@ openerp.Widget = openerp.Class.extend(openerp.PropertiesMixin, {
* @returns {jQuery} selector match
*/
$: function(selector) {
+ if (selector === undefined)
+ return this.$el;
return this.$el.find(selector);
},
/**
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index eab09cc24a0..6241fe6da28 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -241,6 +241,8 @@ my.InputView = instance.web.Widget.extend({
setTimeout(function () {
// Read text content (ignore pasted HTML)
var data = this.$el.text();
+ if (!data)
+ return;
// paste raw text back in
this.$el.empty().text(data);
this.el.normalize();
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index d36ac353461..324896112cc 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -724,7 +724,10 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
self.trigger("save", result);
self.to_view_mode();
}).then(function(result) {
- self.ViewManager.ActionManager.__parentedParent.menu.do_reload_needaction();
+ var parent = self.ViewManager.ActionManager.getParent();
+ if(parent){
+ parent.menu.do_reload_needaction();
+ }
});
},
on_button_cancel: function(event) {
@@ -2997,8 +3000,11 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w
})();
/**
- * A mixin containing some useful methods to handle completion inputs.
- */
+ A mixin containing some useful methods to handle completion inputs.
+
+ The widget containing this option can have these arguments in its widget options:
+ - no_quick_create: if true, it will disable the quick create
+*/
instance.web.form.CompletionFieldMixin = {
init: function() {
this.limit = 7;
@@ -3044,7 +3050,8 @@ instance.web.form.CompletionFieldMixin = {
}
// quick create
var raw_result = _(data.result).map(function(x) {return x[1];});
- if (search_val.length > 0 && !_.include(raw_result, search_val)) {
+ if (search_val.length > 0 && !_.include(raw_result, search_val) &&
+ ! (self.options && self.options.no_quick_create)) {
values.push({
label: _.str.sprintf(_t('Create "<strong>%s</strong>"'),
$('<span />').text(search_val).html()),
@@ -4053,7 +4060,13 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
else
return $.when();
}).done(function () {
- self.handle_button(name, id, callback);
+ if (!self.o2m.options.reload_on_button) {
+ self.handle_button(name, id, callback);
+ }else {
+ self.handle_button(name, id, function(){
+ self.o2m.view.reload();
+ });
+ }
});
},
diff --git a/addons/web/static/src/js/view_tree.js b/addons/web/static/src/js/view_tree.js
index 5604edf147d..2f92042c4d0 100644
--- a/addons/web/static/src/js/view_tree.js
+++ b/addons/web/static/src/js/view_tree.js
@@ -166,12 +166,13 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
var is_loaded = 0,
$this = $(this),
record_id = $this.data('id'),
+ row_parent_id = $this.data('row-parent-id'),
record = self.records[record_id],
children_ids = record[self.children_field];
_(children_ids).each(function(childid) {
- if (self.$el.find('#treerow_' + childid).length) {
- if (self.$el.find('#treerow_' + childid).is(':hidden')) {
+ if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').length ) {
+ if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').is(':hidden')) {
is_loaded = -1;
} else {
is_loaded++;
@@ -183,7 +184,7 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
self.getdata(record_id, children_ids);
}
} else {
- self.showcontent(record_id, is_loaded < 0);
+ self.showcontent($this, record_id, is_loaded < 0);
}
});
},
@@ -195,7 +196,6 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
_(records).each(function (record) {
self.records[record.id] = record;
});
-
var $curr_node = self.$el.find('#treerow_' + id);
var children_rows = QWeb.render('TreeView.rows', {
'records': records,
@@ -204,9 +204,9 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
'fields': self.fields,
'level': $curr_node.data('level') || 0,
'render': instance.web.format_value,
- 'color_for': self.color_for
+ 'color_for': self.color_for,
+ 'row_parent_id': id
});
-
if ($curr_node.length) {
$curr_node.addClass('oe_open');
$curr_node.after(children_rows);
@@ -246,14 +246,13 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
},
// show & hide the contents
- showcontent: function (record_id, show) {
- this.$el.find('#treerow_' + record_id)
- .toggleClass('oe_open', show);
-
+ showcontent: function (curnode,record_id, show) {
+ curnode.parent('tr').toggleClass('oe_open', show);
_(this.records[record_id][this.children_field]).each(function (child_id) {
- var $child_row = this.$el.find('#treerow_' + child_id);
+ var $child_row = this.$el.find('[id=treerow_' + child_id + '][data-row-parent-id='+ curnode.data('id') +']');
if ($child_row.hasClass('oe_open')) {
- this.showcontent(child_id, false);
+ $child_row.toggleClass('oe_open',show);
+ this.showcontent($child_row, child_id, false);
}
$child_row.toggle(show);
}, this);
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 27b85d49e5a..ee87237d045 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -684,7 +684,8 @@
<tr t-name="TreeView.rows"
t-foreach="records" t-as="record"
t-att-id="'treerow_' + record.id"
- t-att-data-id="record.id" t-att-data-level="level + 1">
+ t-att-data-id="record.id" t-att-data-level="level + 1"
+ t-att-data-row-parent-id="row_parent_id">
<t t-set="children" t-value="record[children_field]"/>
<t t-set="class" t-value="children and children.length ? 'treeview-tr' : 'treeview-td'"/>
<t t-set="rank" t-value="'oe-treeview-first'"/>