reason = fields.Many2many('fo.purpose', string='Purpose Of Visit', ondelete='restrict')
its remove my reference data ....why?
second question
what is the difference between ondelete='restrict' and ondelete='cascade' ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
reason = fields.Many2many('fo.purpose', string='Purpose Of Visit', ondelete='restrict')
its remove my reference data ....why?
second question
what is the difference between ondelete='restrict' and ondelete='cascade' ?
Hello,
@api.multi
def unlink(self):
visit_obj = self.env['visit_model']
obj = visit_obj.search([('reason', 'in', self.ids)])
if obj:
raise exceptions.ValidationError(_("You are trying to delete a record that is still referenced!"))
return super(yourclass, self).unlink()
Thanks
thanks it's working
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
ก.พ. 24
|
1447 | ||
|
0
ก.ค. 24
|
2368 | ||
|
0
ก.ค. 22
|
60 | ||
|
1
ก.ค. 22
|
2307 | ||
|
2
ธ.ค. 23
|
32898 |
regarding your second question, you can find your answer here: https://www.odoo.com/id_ID/forum/help-1/ondelete-optional-parameter-19283