跳至内容
菜单
此问题已终结
3262 查看

Hello everyone, I create a custom widget, then I set it for a field () in formview ,widget show in form, but however when I save form , I can not update value in that field , It still get old value.

Here is my js code


odoo.define('my_widget.rule_widget', function (require) {
'use strict'; 

var basic_fields = require('web.basic_fields'); 

var core = require('web.core'); 

var field_registry = require('web.field_registry'); var _t = core._t;
var RuleWidget = basic_fields.FieldChar.extend({ 

    template: 'RuleWidget', 

    events: { 'click .btn_setting': '_onClickSetting', }, 

    start: function () { 

        return this._super.apply(this, arguments); 

    },
    _render: function () { 

        this._super.apply(this, arguments);
    },

     _onClickSetting: function () { 

        this.do_action({ 

            name: 'Setting Rule', 

            type: 'ir.actions.act_window', 

            res_model: 'wizard.rule', 

            target: 'new', 

            views: [[false, 'form']], 

        }); 

    },
}); 

field_registry.add('rule', RuleWidget)

xml code

https://www.linkpicture.com/view.php?img=LPic61cd2bf0d45771201290826
    
        
            
          

  

 

形象
丢弃
相关帖文 回复 查看 活动
1
10月 20
5302
0
9月 18
4335
0
1月 24
1095
1
5月 23
2913
1
3月 22
2810