<commit_before>openerp.pad = function(instance) {
    
    instance.web.form.FieldPad = instance.web.form.AbstractField.extend({
        template: 'FieldPad',
        configured: false,
        content: "",
        render_value: function() {
            var self = this;
            if (this.get("value") === false || this.get("value") === "") {
                self.view.dataset.call('pad_generate_url',{context:{
                        model: self.view.model,
                        field_name: self.name,
                        object_id: self.view.datarecord.id
                    }}).then(function(data) {
                    if(data&&data.url){
                        _super.apply(self,[data.url]);
                        self.renderElement();
                    }
                });
            } else {
                self.renderElement();
            }
            this._dirty_flag = true;
        },
        renderElement: function(){
            var self  = this;
            var value = this.get('value');
            if(!_.str.startsWith(value,'http')){
                this.configured = false;
                this.content = "";
            }else{
                this.configured = true;
                if(!this.get('effective_readonly')){
                    this.content = '<iframe width="100%" height="100%" frameborder="0" src="'+value+'?showChat=false&userName='+this.session.username+'"></iframe>';
                }else{
                    this.content = '<div class="oe_pad_loading">... Loading pad ...</div>';
                    $.get(value+'/export/html').success(function(data){
                        self.$('.oe_pad_content').html('<div class="oe_pad_readonly">'+data+'<div>');
                    }).error(function(){
                        self.$('.oe_pad_content').text('Unable to load pad');
                    });
                }
            }
            this._super();
            this.$('.oe_pad_content').html(this.content);
            this.$('.oe_pad_switch').click(function(){
                self.$el.toggleClass('oe_pad_fullscreen');
            });
            this.on('change:effective_readonly',this,function(){
                self.renderElement();
            });
        },
    });<commit_msg>[FIX] pad: render_value broken on create of new task<commit_after>openerp.pad = function(instance) {
    
    instance.web.form.FieldPad = instance.web.form.AbstractField.extend({
        template: 'FieldPad',
        configured: false,
        content: "",
        render_value: function() {
            var self = this;
            if (!this.get("value")) {
                self.view.dataset.call('pad_generate_url',{context:{
                        model: self.view.model,
                        field_name: self.name,
                        object_id: self.view.datarecord.id
                    }}).then(function(data) {
                    if(data && data.url){
                        self.set_value(data.url);
                    }
                });
            }
            self.renderElement();
            this._dirty_flag = true;
        },
        renderElement: function(){
            var self  = this;
            var value = this.get('value');
            if(!_.str.startsWith(value,'http')){
                this.configured = false;
                this.content = "";
            }else{
                this.configured = true;
                if(!this.get('effective_readonly')){
                    this.content = '<iframe width="100%" height="100%" frameborder="0" src="'+value+'?showChat=false&userName='+this.session.username+'"></iframe>';
                }else{
                    this.content = '<div class="oe_pad_loading">... Loading pad ...</div>';
                    $.get(value+'/export/html').success(function(data){
                        self.$('.oe_pad_content').html('<div class="oe_pad_readonly">'+data+'<div>');
                    }).error(function(){
                        self.$('.oe_pad_content').text('Unable to load pad');
                    });
                }
            }
            this._super();
            this.$('.oe_pad_content').html(this.content);
            this.$('.oe_pad_switch').click(function(){
                self.$el.toggleClass('oe_pad_fullscreen');
            });
            this.on('change:effective_readonly',this,function(){
                self.renderElement();
            });
        },
    });
{'fraction_non_alphanumeric': 0.15263394867176946, 'fraction_numerical': 0.0031517334533993696, 'mean_word_length': 1.408130081300813, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2111943', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1108, 'n_words': 157}