我需要覆盖小部件render_value
的函数instance.web.form.FieldSelection
。我试过下面的代码,但什么也没发生。
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 :(得分:0)
this._super.apply(this,arguments);
从方法开始使用它。
希望这会对你有所帮助!!