Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3116 มุมมอง

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

อวตาร
ละทิ้ง

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

คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

@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 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
write() vs update() แก้ไขแล้ว
4
ก.ย. 20
40841
1
มิ.ย. 25
1545
1
มิ.ย. 25
503
Original project names via the API แก้ไขแล้ว
1
เม.ย. 25
1245
2
ม.ค. 25
1348