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

Hello,
When I'm deleting model instance I want to check some conditions and if that conditions are true then allow deleting and if conditions are false don't allow user to delete entry.
So what  I thought, __del__() method is destructor and first I was thinking to use this function but after some testings it doesn't work as I want, so I must find another way. I want to find a way to test conditions before deletion happens and decide allow or not.
If question is still unclear tell me.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I've found a solution: I must override unlink method

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Delete Blank Lines แก้ไขแล้ว
1
ส.ค. 24
1849
Delete Company (Odoo v14) แก้ไขแล้ว
1
พ.ย. 23
4380
Delete my account แก้ไขแล้ว
3
พ.ย. 24
10680
Selecting items for one2many relation แก้ไขแล้ว
2
ธ.ค. 22
14990
1
พ.ย. 21
5121