<commit_before>openerp.web_process = function (openerp) {
    var QWeb = openerp.web.qweb;
    QWeb.add_template('/web_process/static/src/xml/web_process.xml');
    openerp.web.ViewManager.include({
        start: function() {
            this._super();
            var self = this;
            this.process_check();
            this.process_help = this.action ? this.action.help : 'Help: Not Defined';
            this.model = this.dataset.model;
            if(this.action) this.process_model = this.action.res_model;
            else this.process_model = this.model;
        },
        process_check: function() {
            var self = this,
            grandparent = this.widget_parent && this.widget_parent.widget_parent,
            view = this.views[this.views_src[0].view_type],
            $process_view = this.$element.find('.oe-process-view');
            if (!(grandparent instanceof openerp.web.WebClient) ||
                !(view.view_type === this.views_src[0].view_type
                    && view.view_id === this.views_src[0].view_id)) {
                        $process_view.hide();
                        return;
            }
            $process_view.click(function() {
                self.initialize_process_view();
            });
        },
        initialize_process_view: function() {
            var self = this;
            $.when(this.fields_get(), this.help(), this.get_process_object()).pipe(function(fields, help, process) {
                self.process_fields = fields;
                self.process_help = help;
                if(process && process.length) {
                    if(process.length > 1) {
                        self.process_selection = process;
                    } else {
                        self.process_id = process[0][0],
                        self.process_title = process[0][1];
                    }
                }
                return $.Deferred().resolve();
            }).pipe(function() {
                var def = $.Deferred();
                if(self.process_id) {
                    self.graph_get().done(function(res) {
                        self.process_notes = res.notes;
                        self.process_subflows = _.filter(res.nodes, function(x) {
                            return x.subflow != false;
                        });
                        self.process_related = res.related;
                        def.resolve(res);
                    });
                } else def.resolve();
                return def.promise();
            }).done(function(res) {
                $.when(self.render_process_view()).done(function() {
                    if(res) self.draw_process_graph(res);
                });
            });
        },
        graph_get: function() {
            var self = this;
            var def = $.Deferred();
            this.process_id = parseInt(this.process_id, 10);

            this.process_dataset
            .call("graph_get",[this.process_id, this.model || this.dataset.model, false, [80,80,150,100]])
            .done(function(res) {
                self.process_dataset
                    .call("search_by_model",[self.model || self.dataset.model,self.session.context])
                    .done(
                    function(r) {
                        res['related'] = r;
                        def.resolve(res);
                    });
            });
            return def.promise();
        },
        fields_get : function() {
            var self = this,
                def = $.Deferred(),
                dataset = new openerp.web.DataSetStatic(this, this.model || this.dataset.model, this.session.context);
            dataset
                .call('fields_get',[])
                .done(function(fields) {
                    def.resolve(fields);
                }).fail(def.reject);
            return def.promise();
        },
        help : function() {
            var self = this,
                def = $.Deferred();
            if(!this.subflow_model) {
                def.resolve(this.action ? this.action.help : 'Help: Not Defined');
            } else {
                 var dataset = new openerp.web.DataSetSearch(this, "ir.actions.act_window", this.session.context, []);
                 dataset
                    .read_slice(['help'],
                    {
                        domain: [
                            ['res_model', '=', this.subflow_model],
                            ['name', 'ilike', this.subflow_name]
                        ]
                    }
                    ).done(function(res) {
                        def.resolve(res.help || 'Help: Not Defined');
                    });
            }
            return def.promise();
        },
        get_process_object : function() {
            var self = this,
                def = $.Deferred();<commit_msg>[FIX]Fixed code for if help is false.<commit_after>openerp.web_process = function (openerp) {
    var QWeb = openerp.web.qweb;
    QWeb.add_template('/web_process/static/src/xml/web_process.xml');
    openerp.web.ViewManager.include({
        start: function() {
            this._super();
            var self = this;
            this.process_check();
            this.process_help = this.action ? this.action.help : 'Help: Not Defined';
            this.model = this.dataset.model;
            if(this.action) this.process_model = this.action.res_model;
            else this.process_model = this.model;
        },
        process_check: function() {
            var self = this,
            grandparent = this.widget_parent && this.widget_parent.widget_parent,
            view = this.views[this.views_src[0].view_type],
            $process_view = this.$element.find('.oe-process-view');
            if (!(grandparent instanceof openerp.web.WebClient) ||
                !(view.view_type === this.views_src[0].view_type
                    && view.view_id === this.views_src[0].view_id)) {
                        $process_view.hide();
                        return;
            }
            $process_view.click(function() {
                self.initialize_process_view();
            });
        },
        initialize_process_view: function() {
            var self = this;
            $.when(this.fields_get(), this.help(), this.get_process_object()).pipe(function(fields, help, process) {
                self.process_fields = fields;
                self.process_help = help;
                if(process && process.length) {
                    if(process.length > 1) {
                        self.process_selection = process;
                    } else {
                        self.process_id = process[0][0],
                        self.process_title = process[0][1];
                    }
                }
                return $.Deferred().resolve();
            }).pipe(function() {
                var def = $.Deferred();
                if(self.process_id) {
                    self.graph_get().done(function(res) {
                        self.process_notes = res.notes;
                        self.process_subflows = _.filter(res.nodes, function(x) {
                            return x.subflow != false;
                        });
                        self.process_related = res.related;
                        def.resolve(res);
                    });
                } else def.resolve();
                return def.promise();
            }).done(function(res) {
                $.when(self.render_process_view()).done(function() {
                    if(res) self.draw_process_graph(res);
                });
            });
        },
        graph_get: function() {
            var self = this;
            var def = $.Deferred();
            this.process_id = parseInt(this.process_id, 10);

            this.process_dataset
            .call("graph_get",[this.process_id, this.model || this.dataset.model, false, [80,80,150,100]])
            .done(function(res) {
                self.process_dataset
                    .call("search_by_model",[self.model || self.dataset.model,self.session.context])
                    .done(
                    function(r) {
                        res['related'] = r;
                        def.resolve(res);
                    });
            });
            return def.promise();
        },
        fields_get : function() {
            var self = this,
                def = $.Deferred(),
                dataset = new openerp.web.DataSetStatic(this, this.model || this.dataset.model, this.session.context);
            dataset
                .call('fields_get',[])
                .done(function(fields) {
                    def.resolve(fields);
                }).fail(def.reject);
            return def.promise();
        },
        help : function() {
            var self = this,
                def = $.Deferred();
            if(!this.subflow_model) {
                def.resolve(this.action ? (this.action.help!=false ? this.action.help : 'Help: Not Defined') : 'Help: Not Defined');
            } else {
                 var dataset = new openerp.web.DataSetSearch(this, "ir.actions.act_window", this.session.context, []);
                 dataset
                    .read_slice(['help'],
                    {
                        domain: [
                            ['res_model', '=', this.subflow_model],
                            ['name', 'ilike', this.subflow_name]
                        ]
                    }
                    ).done(function(res) {
                        def.resolve(res.help || 'Help: Not Defined');
                    });
            }
            return def.promise();
        },
        get_process_object : function() {
            var self = this,
                def = $.Deferred();
{'fraction_non_alphanumeric': 0.12395172836980978, 'fraction_numerical': 0.0040908161178155045, 'mean_word_length': 1.2459807073954985, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3737443', 'n_tokens_mistral': 2565, 'n_tokens_neox': 2435, 'n_words': 399}