<commit_before>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) {
                self.set("configured", !!data);
            }).fail(function(data, event) {
                event.preventDefault();
                self.set("configured", true);
            });
        },
        initialize_content: function() {
            var self = this;
            this.$('.oe_pad_switch').click(function() {
                self.$el.toggleClass('oe_pad_fullscreen');
                self.view.$el.find('.oe_chatter').toggle();
            });
            this._configured_deferred.always(function() {
                var configured = self.get('configured');
                self.$(".oe_unconfigured").toggle(!configured);
                self.$(".oe_configured").toggle(configured);
            });
            this.render_value();
        },
        render_value: function() {
            var self = this;
            this._configured_deferred.always(function() {
                if (! self.get('configured')) {
                    return;
                };
                var value = self.get('value');
                if (self.get('effective_readonly')) {
                    if (_.str.startsWith(value, 'http')) {
                        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);
                        }).fail(function() {
                            self.$('.oe_pad_content').text(_t('Unable to load pad'));
                        });
                    } else {
                        self.$('.oe_pad_content').addClass('oe_pad_loading').show().text(_t("This pad will be initialized on first edit"));
                    }
                }<commit_msg>[FIX] pad: pad in readonly when opening form view in edit mode - opw 606208<commit_after>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) {
                self.set("configured", !!data);
            }).fail(function(data, event) {
                event.preventDefault();
                self.set("configured", true);
            });
        },
        initialize_content: function() {
            var self = this;
            this.$('.oe_pad_switch').click(function() {
                self.$el.toggleClass('oe_pad_fullscreen');
                self.view.$el.find('.oe_chatter').toggle();
            });
            this._configured_deferred.always(function() {
                var configured = self.get('configured');
                self.$(".oe_unconfigured").toggle(!configured);
                self.$(".oe_configured").toggle(configured);
            });
            this.render_value();
        },
        render_value: function() {
            var self = this;
            this._configured_deferred.always(function() {
                if (! self.get('configured')) {
                    return;
                };
                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) {
                            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'));
                        });
                    } else {
                        self.$('.oe_pad_content').addClass('oe_pad_loading').show().text(_t("This pad will be initialized on first edit"));
                    }
                }
{'fraction_non_alphanumeric': 0.14353279868393995, 'fraction_numerical': 0.0012338062924120913, 'mean_word_length': 1.5913692061800746, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1983356', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1221, 'n_words': 174}