diff options
| author | Adrian Torres <adt@odoo.com> | 2020-02-20 13:43:00 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-03-30 13:42:04 +0000 |
| commit | 1daf8eb12735db5c697e4a0868b43fe44f6b2f6a (patch) | |
| tree | b02820d3679615e7e92a6258a6cc1d428db4c526 /addons/event_sms/models | |
| parent | f0481392c6501cae2c38359f526da1eefa451337 (diff) | |
[FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.
This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.
closes odoo/odoo#46325
Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/event_sms/models')
| -rw-r--r-- | addons/event_sms/models/event_mail.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/addons/event_sms/models/event_mail.py b/addons/event_sms/models/event_mail.py index 14d43ec1373..53562875f10 100644 --- a/addons/event_sms/models/event_mail.py +++ b/addons/event_sms/models/event_mail.py @@ -7,7 +7,9 @@ from odoo import api, fields, models class EventTypeMail(models.Model): _inherit = 'event.type.mail' - notification_type = fields.Selection(selection_add=[('sms', 'SMS')]) + notification_type = fields.Selection(selection_add=[ + ('sms', 'SMS') + ], ondelete={'sms': 'set default'}) sms_template_id = fields.Many2one( 'sms.template', string='SMS Template', domain=[('model', '=', 'event.registration')], ondelete='restrict', @@ -21,7 +23,9 @@ class EventTypeMail(models.Model): class EventMailScheduler(models.Model): _inherit = 'event.mail' - notification_type = fields.Selection(selection_add=[('sms', 'SMS')]) + notification_type = fields.Selection(selection_add=[ + ('sms', 'SMS') + ], ondelete={'sms': 'set default'}) sms_template_id = fields.Many2one( 'sms.template', string='SMS Template', domain=[('model', '=', 'event.registration')], ondelete='restrict', |
