From d802f5f6945a63e5e18d0a74a2d863d976d6b6fd Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 11 Jun 2015 12:15:00 +0200 Subject: [PATCH] [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 --- addons/pad/static/src/js/pad.js | 14 +++++++------- 1 file 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 = ''; + var content = ''; self.$('.oe_pad_content').html(content); self._dirty_flag = true; }