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

Hello,

I want to know what is the orm model function to call if my model changed without the UI event ?

I'd like to use @api.onchange('state') to execute a method. But it does not work because @api.onchange only works if the UI change value. What is the function to call if backend/background changed without the UI event ??


Thanks

Ảnh đại diện
Huỷ bỏ

Can you give some details like what you want to achieve using a function?

Câu trả lời hay nhất

create() and write() function anyway need to invoke whenever you need to add any updates in the corresponding model. So you can trace any changes through these ORM Functions.

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

@api.constrains('state') should the trick for you.

This is called whenever the state field is written to, whether it's saving from the UI, or from another call.

Cheers,

Jake Robinson 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
write() vs update() Đã xử lý
4
thg 9 20
41861
1
thg 8 25
356
2
thg 7 25
2804
3
thg 7 25
624
1
thg 6 25
2073