覆盖odoo 8中的JS函数
16lz
2021-01-22
I need to override a function render_value
of widget instance.web.form.FieldSelection
. i have tried below code but nothing happened.
我需要覆盖widget instance.web.form.FieldSelection的函数render_value。我试过下面的代码,但什么也没发生。
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]);
}
},
});
};
1 个解决方案
#1
0
this._super.apply(this, arguments);
this._super.apply(this,arguments);
use this in method from starting.
从方法开始使用它。
Hope this will help you !!
希望对你有帮助 !!
更多相关文章
- 如何在SOF上的新帖子中没有像“Grippie”这样的'onclick'执行Jav
- JavaScript 函数柯里化(参考《JavaScript模式》)
- js中匿名函数的写法
- mongojs的异步调用找到函数
- 在JavaScript中的for循环中调用异步函数
- Javascript学习之匿名函数与自执行详解
- 第三节(JavaScript 对象、日期,函数)
- 用javaScript编写的验证函数只运行一次?
- 无法从按钮onclick事件ASP.NET 4调用Javascript函数