summaryrefslogtreecommitdiff
path: root/addons/pad/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2015-06-11 12:15:00 +0200
committerChristophe Simonis <chs@odoo.com>2015-06-11 12:15:00 +0200
commitd802f5f6945a63e5e18d0a74a2d863d976d6b6fd (patch)
tree6f48a83d83042d6c0dd2a1b37a7ef9d535e7e37b /addons/pad/static/src
parent9e36cf72c94b213525ac20270d8d03ca8d7220e8 (diff)
[FIX] pad: correct pad.js
- better use of deferred - avoid useless re-render of widget by using `internal_set_value` - encode username in pad url
Diffstat (limited to 'addons/pad/static/src')
-rw-r--r--addons/pad/static/src/js/pad.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js
index a6f2ce69553..d12d9b48982 100644
--- a/addons/pad/static/src/js/pad.js
+++ b/addons/pad/static/src/js/pad.js
@@ -1,13 +1,13 @@
openerp.pad = function(instance) {
var _t = instance.web._t;
-
+
instance.web.form.FieldPad = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeWidgetMixin, {
template: 'FieldPad',
content: "",
init: function() {
var self = this;
this._super.apply(this, arguments);
- this._configured_deferred = this.view.dataset.call('pad_is_configured').done(function(data) {
+ this._configured_deferred = this.view.dataset.call('pad_is_configured').then(function(data) {
self.set("configured", !!data);
}).fail(function(data, event) {
event.preventDefault();
@@ -33,9 +33,9 @@ openerp.pad = function(instance) {
render_value: function() {
var self = this;
$.when(this._configured_deferred, this.pad_loading_request).always(function() {
- if (! self.get('configured')) {
+ if (!self.get('configured')){
return;
- };
+ }
var value = self.get('value');
if (self.get('effective_readonly')) {
if (_.str.startsWith(value, 'http')) {
@@ -58,18 +58,18 @@ openerp.pad = function(instance) {
field_name: self.name,
object_id: self.view.datarecord.id
},
- }).done(function(data) {
+ }).then(function(data) {
if (! data.url) {
self.set("configured", false);
} else {
- self.set("value", data.url);
+ self.internal_set_value(data.url);
}
});
}
def.then(function() {
value = self.get('value');
if (_.str.startsWith(value, 'http')) {
- var content = '<iframe width="100%" height="100%" frameborder="0" src="' + value + '?showChat=false&userName=' + self.session.username + '"></iframe>';
+ var content = '<iframe width="100%" height="100%" frameborder="0" src="' + value + '?showChat=false&userName=' + encodeURIComponent(self.session.username) + '"></iframe>';
self.$('.oe_pad_content').html(content);
self._dirty_flag = true;
}