Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6870 Widoki

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

Awatar
Odrzuć

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

Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

thanks it's working

Powiązane posty Odpowiedzi Widoki Czynność
1
lut 24
2619
0
lip 24
3873
0
lip 22
60
1
lip 22
3677
2
gru 23
34243