Skip to Content
Menu
This question has been flagged
2145 Views

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
    
        
            
          

  

 

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 20
4401
0
Sep 18
3622
0
Jan 24
350
1
May 23
1907
1
Mar 22
1955