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

Hi,
how can I set event listener (from javascript) for change on Many2one field? Field is showed like select (but in HTML is text input field). Listener works if I write in field but if I change option by selection from list, no event is fired. I need it from javascript becouse I want change select options in other field. Or it's posible from python?

形象
丢弃
最佳答案

Hi,

There is already a function called "onSelect" in Many2XAutocomplete component so you can use that by patching it.

/** @odoo-module **/
import { Many2XAutocomplete } from "@web/views/fields/relational_utils";

import { patch } from "@web/core/utils/patch";

patch(Many2XAutocomplete.prototype, "file_path or something unique", {
onSelect(option, params = {}){
// your code
this._super.apply(this, arguments);
}
})

Regards

形象
丢弃
相关帖文 回复 查看 活动
1
4月 24
2125
0
1月 24
1699
1
9月 23
3124
2
4月 23
5303
2
1月 23
7779