Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3032 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 24
2531
0
thg 1 24
2037
1
thg 9 23
3523
2
thg 4 23
5676
2
thg 1 23
8134