summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2013-03-15 10:01:12 +0100
committerOlivier Dony <odo@openerp.com>2013-03-15 10:01:12 +0100
commit8e06ab16d011bb1940be6bdaa298a4cbbf0d236a (patch)
treed5e70e273e5ab34138bedffee65528c17411ff1c /addons/web/static/src/js
parente23fba677e71511d5f9d2d03b84ff7472ce0dcca (diff)
parentdcc9a3aeabd304bd145c1d9156b06ba914a251d7 (diff)
[MERGE] Bugfixes from the 7.0 branch, up to rev. 3845
rev.3845 = launchpad_translations_on_behalf_of_openerp-20130315064417-68iimts1xgj8bn5z bzr revid: odo@openerp.com-20130315090112-n4h5wpxk2sjhwvrd
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/chrome.js5
-rw-r--r--addons/web/static/src/js/view_form.js14
-rw-r--r--addons/web/static/src/js/views.js31
3 files changed, 38 insertions, 12 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index c3f9f6af357..696f25109a9 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -1539,8 +1539,9 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
});
},
- do_action: function(action) {
- return this.action_manager.do_action(action);
+ do_action: function(/*...*/) {
+ var am = this.action_manager;
+ return am.do_action.apply(am, arguments);
},
authenticate: function() {
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index cd27bd68b27..3d80a7b4fac 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2357,7 +2357,8 @@ instance.web.form.FieldUrl = instance.web.form.FieldChar.extend({
if (!s) {
tmp = "http://" + this.get('value');
}
- this.$el.find('a').attr('href', tmp).text(this.get('value') ? tmp : '');
+ var text = this.get('value') ? this.node.attrs.text || tmp : '';
+ this.$el.find('a').attr('href', tmp).text(text);
}
},
on_button_clicked: function() {
@@ -2602,7 +2603,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
this.$textarea.trigger("autosize");
}
} else {
- var txt = this.get("value");
+ var txt = this.get("value") || '';
this.$(".oe_form_text_content").text(txt);
}
},
@@ -2663,7 +2664,7 @@ instance.web.form.FieldTextHtml = instance.web.form.AbstractField.extend(instanc
"| removeformat | bullets numbering | outdent " +
"indent | link unlink | source",
bodyStyle: // style to assign to document body contained within the editor
- "margin:4px; color:#4c4c4c; font-size:13px; font-family:\"Lucida Grande\",Helvetica,Verdana,Arial,sans-serif; cursor:text"
+ "margin:4px; color:#4c4c4c; font-size:13px; font-family:'Lucida Grande',Helvetica,Verdana,Arial,sans-serif; cursor:text"
});
this.$cleditor = this.$textarea.cleditor()[0];
this.$cleditor.change(function() {
@@ -5301,7 +5302,12 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
},
calc_domain: function() {
var d = instance.web.pyeval.eval('domain', this.build_domain());
- domain = ['|', ['id', '=', this.get('value')]].concat(d);
+ var domain = []; //if there is no domain defined, fetch all the records
+
+ if (d.length) {
+ domain = ['|',['id', '=', this.get('value')]].concat(d);
+ }
+
if (! _.isEqual(domain, this.get("evaluated_selection_domain"))) {
this.set("evaluated_selection_domain", domain);
}
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 1ba65f7ec18..7b2fc87aa97 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -149,6 +149,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
for (var i = 0; i < this.breadcrumbs.length; i += 1) {
var item = this.breadcrumbs[i];
var tit = item.get_title();
+ if (item.hide_breadcrumb) {
+ continue;
+ }
if (!_.isArray(tit)) {
tit = [tit];
}
@@ -282,6 +285,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
* @param {Object} [options]
* @param {Boolean} [options.clear_breadcrumbs=false] Clear the breadcrumbs history list
* @param {Function} [options.on_reverse_breadcrumb] Callback to be executed whenever an anterior breadcrumb item is clicked on.
+ * @param {Function} [options.hide_breadcrumb] Do not display this widget's title in the breadcrumb
* @param {Function} [options.on_close] Callback to be executed when the dialog is closed (only relevant for target=new actions)
* @param {Function} [options.action_menu_id] Manually set the menu id on the fly.
* @param {Object} [options.additional_context] Additional context to be merged with the action's context.
@@ -291,6 +295,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
options = _.defaults(options || {}, {
clear_breadcrumbs: false,
on_reverse_breadcrumb: function() {},
+ hide_breadcrumb: false,
on_close: function() {},
action_menu_id: null,
additional_context: {},
@@ -403,7 +408,12 @@ instance.web.ActionManager = instance.web.Widget.extend({
widget: function () { return new instance.web.ViewManagerAction(self, action); },
action: action,
klass: 'oe_act_window',
- post_process: function (widget) { widget.add_breadcrumb(options.on_reverse_breadcrumb); }
+ post_process: function (widget) {
+ widget.add_breadcrumb({
+ on_reverse_breadcrumb: options.on_reverse_breadcrumb,
+ hide_breadcrumb: options.hide_breadcrumb,
+ });
+ },
}, options);
},
ir_actions_client: function (action, options) {
@@ -427,6 +437,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
widget: widget,
title: action.name,
on_reverse_breadcrumb: options.on_reverse_breadcrumb,
+ hide_breadcrumb: options.hide_breadcrumb,
});
if (action.tag !== 'reload') {
self.do_push_state({});
@@ -649,7 +660,15 @@ instance.web.ViewManager = instance.web.Widget.extend({
set_title: function(title) {
this.$el.find('.oe_view_title_text:first').text(title);
},
- add_breadcrumb: function(on_reverse_breadcrumb) {
+ add_breadcrumb: function(options) {
+ var options = options || {};
+ // 7.0 backward compatibility
+ if (typeof options == 'function') {
+ options = {
+ on_reverse_breadcrumb: options
+ };
+ }
+ // end of 7.0 backward compatibility
var self = this;
var views = [this.active_view || this.views_src[0].view_type];
this.on('switch_mode', self, function(mode) {
@@ -661,7 +680,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
views.push(mode);
}
});
- this.getParent().push_breadcrumb({
+ var item = _.extend({
widget: this,
action: this.action,
show: function(index) {
@@ -695,9 +714,9 @@ instance.web.ViewManager = instance.web.Widget.extend({
titles.pop();
}
return titles;
- },
- on_reverse_breadcrumb: on_reverse_breadcrumb,
- });
+ }
+ }, options);
+ this.getParent().push_breadcrumb(item);
},
/**
* Returns to the view preceding the caller view in this manager's