Skip to Content
Menu
This question has been flagged

I have a module that contains field1 and field2. Field1 is a normal char field and field2 is a one2many relation field with widget many2many_tags and also one button.

After clicking on the crate and edit option of one2many field focus will go to field1, then the user enters some text in field1 and this text is shown in field2(one2many field) after a click on the button.

For that I have written the following code:

odoo.define('survey_inherit.button_click',function(require){
"use strict";
console.log('button action file');
var form_controller = require('web.FormController');
var _t = core._t;
var QWeb = core.qweb;*/

form_controller.include({

    _onButtonClicked: function(event) {
         if(event.data.attrs.id === "button_click"){

            // YOUR CODE

    console.log('Button');
    var question = $('.question_class').val();
    $('.ui-autocomplete-input').val(question);
    console.log(question);
    var test = $('.ui-autocomplete-input').val();
    console.log('many2one:'+test);

            return;
         }
    this._super(event);
    },  
});

with the help of the above code on one2many fields, I am able to receive the value of field1 but it is not displayed in one2many fields.

Can anyone please help me or any suggestions to do the same. It will be appreciated.

Thanks in advance


Avatar
Discard
Related Posts Replies Views Activity
1
Jan 23
6363
4
Mar 21
5326
2
Feb 20
3228
0
Jan 20
3069
1
Dec 19
7350