Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
6862 Tampilan

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' ?

Avatar
Buang

regarding your second question, you can find your answer here: https://www.odoo.com/id_ID/forum/help-1/ondelete-optional-parameter-19283

Jawaban Terbai

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

Avatar
Buang
Penulis

thanks it's working

Post Terkait Replies Tampilan Aktivitas
1
Feb 24
2615
0
Jul 24
3865
0
Jul 22
60
1
Jul 22
3672
2
Des 23
34240