2017-03-13 9 views
0

ウィジェットinstance.web.form.FieldSelectionの関数render_valueをオーバーライドする必要があります。私は以下のコードを試したが、何も起こらなかった。odooでJS関数をオーバーライドする8

openerp.my_ModuleName = function(instance) { 

    instance.web.form.FieldSelection.include({ 
    render_value: function() { 

    var values = this.get("values"); 
    values = [[false, this.node.attrs.placeholder || 'Select']].concat(values); 
    var found = _.find(values, function(el) { return el[0] === this.get("value"); }, this); 
    if (! found) { 
     found = [this.get("value"), _t('Unknown')]; 
     values = [found].concat(values); 
    } 
    if (! this.get("effective_readonly")) { 
     this.$().html(QWeb.render("FieldSelectionSelect", {widget: this, values: values})); 
     this.$("select").val(JSON.stringify(found[0])); 
    } else { 
     this.$el.text(found[1]); 
    } 
    }, 

    }); 
}; 

答えて

0

this._super.apply(この引数)。

このメソッドを開始から使用します。

これはあなたを助けますように!

関連する問題