跳至内容
菜单
此问题已终结
1 回复
1486 查看

Hello! 

I have a problem triggering the event at a many2one field in a popover from mrp.workorder 

this is the field i put:
<div class="row">                <span class="col-6">Seleccione un Tambor</span>                <span name="selected_pope_id" class="o_field_widget col-4 pe-2">                    <Many2OneField t-props="tamborInfo" t-on-change="updateSelectedPope"/>                </span>            </div>

and this is the js/owl component:
get tamborInfo() {        return {            name: "selected_pope_id",            record: this.props.record,        };    }

this get the values for selected_pope_id, thats ok... but When i click in one of the registries, doesnt trigger.. never gets in the update o in the t-on-change and I dont know why, If somebody could help please!

thanks!

形象
丢弃
最佳答案

Hi,

In the Many2OneField component, you don't need to add t-on-change. You can pass the update function directly in the props.


Modify your tamborInfo function like this


get tamborInfo() {

    return {

        name: "selected_pope_id",

        record: this.props.record,

        update: this.updateSelectedPope.bind(this),

    };

}


Then, use it in your template:

<Many2OneField t-props="tamborInfo"/>

In the updateSelectedPope function, you can handle the updated value as needed.


Hope it helps

形象
丢弃
编写者

hello!! thank you so much for you answer!! it helped a lot!

相关帖文 回复 查看 活动
3
10月 23
5211
0
3月 25
1074
1
12月 23
1735
0
12月 23
1766
1
10月 23
5472