[FIX] pad: pad in readonly when opening form view in edit mode - opw 606208
authorAnael Closson <acl@openerp.com>
Wed, 9 Apr 2014 11:48:25 +0000 (13:48 +0200)
committerAnael Closson <acl@openerp.com>
Wed, 9 Apr 2014 11:48:25 +0000 (13:48 +0200)
bzr revid: acl@openerp.com-20140409114825-t10ps6o7qn7qbd7y

addons/pad/static/src/js/pad.js

index e04184b..c939c92 100644 (file)
@@ -36,9 +36,12 @@ openerp.pad = function(instance) {
                 var value = self.get('value');
                 if (self.get('effective_readonly')) {
                     if (_.str.startsWith(value, 'http')) {
+                        self.$('.oe_pad_content').addClass('oe_pad_loading')
                         this.pad_loading_request = self.view.dataset.call('pad_get_content', {url: value}).done(function(data) {
-                            self.$('.oe_pad_content').removeClass('oe_pad_loading').html('<div class="oe_pad_readonly"><div>');
-                            self.$('.oe_pad_readonly').html(data);
+                            if (self.$('.oe_pad_loading').length) {
+                                self.$('.oe_pad_content').removeClass('oe_pad_loading').html('<div class="oe_pad_readonly"><div>');
+                                self.$('.oe_pad_readonly').html(data);
+                            }
                         }).fail(function() {
                             self.$('.oe_pad_content').text(_t('Unable to load pad'));
                         });