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 !!

希望对你有帮助 !!

更多相关文章

  1. 如何在SOF上的新帖子中没有像“Grippie”这样的'onclick'执行Jav
  2. JavaScript 函数柯里化(参考《JavaScript模式》)
  3. js中匿名函数的写法
  4. mongojs的异步调用找到函数
  5. 在JavaScript中的for循环中调用异步函数
  6. Javascript学习之匿名函数与自执行详解
  7. 第三节(JavaScript 对象、日期,函数)
  8. 用javaScript编写的验证函数只运行一次?
  9. 无法从按钮onclick事件ASP.NET 4调用Javascript函数

随机推荐

  1. SpringBoot 与 Kotlin 完美交融
  2. 值得关注的 Vue.js开源项目[每日前端夜话
  3. 「面试题」介绍你做过最复杂的系统
  4. 如何健壮你的后端服务
  5. 技术探讨的正确姿势
  6. 谷歌助力,快速实现 Java 应用容器化
  7. Java 12 正式发布
  8. 探寻 Redis 内存诡异增长的元凶
  9. npm 和 yarn 你选哪个?[每日前端夜话0x100
  10. 人人都是 API 设计者:我对 RESTful API、G