Skip to Content
Menú
This question has been flagged
1 Respondre
6855 Vistes

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
Descartar

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

Best Answer

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
Descartar
Autor

thanks it's working

Related Posts Respostes Vistes Activitat
1
de febr. 24
2577
0
de jul. 24
3810
0
de jul. 22
60
1
de jul. 22
3632
2
de des. 23
34207