[FIX] *: adapt code to comply with new ondelete policy

The ondelete policy must be explicitly set for m2o fields whose inverse
is a reflection model (ir.*)
This commit is contained in:
Adrian Torres
2019-11-07 08:39:17 +00:00
parent 2dccf4d6cd
commit 3da477dfc5
6 changed files with 11 additions and 8 deletions
@@ -18,4 +18,7 @@ class FrequencyField(models.Model):
_description = 'Fields that can be used for predictive lead scoring computation'
name = fields.Char(related="field_id.field_description")
field_id = fields.Many2one('ir.model.fields', domain=[('model_id.model', '=', 'crm.lead')], required=True)
field_id = fields.Many2one(
'ir.model.fields', domain=[('model_id.model', '=', 'crm.lead')], required=True,
ondelete='cascade',
)
+1 -1
View File
@@ -175,7 +175,7 @@ class GoogleDrive(models.Model):
return config_values
name = fields.Char('Template Name', required=True)
model_id = fields.Many2one('ir.model', 'Model', required=True)
model_id = fields.Many2one('ir.model', 'Model', required=True, ondelete='cascade')
model = fields.Char('Related Model', related='model_id.model', readonly=True)
filter_id = fields.Many2one('ir.filters', 'Filter', domain="[('model_id', '=', model)]")
google_drive_template_url = fields.Char('Template URL', required=True)
+1 -1
View File
@@ -20,7 +20,7 @@ class SMSTemplate(models.Model):
model_id = fields.Many2one(
'ir.model', string='Applies to', required=True,
domain=['&', ('is_mail_thread_sms', '=', True), ('transient', '=', False)],
help="The type of document this template can be used with")
help="The type of document this template can be used with", ondelete='cascade')
model = fields.Char('Related Document Model', related='model_id.model', index=True, store=True, readonly=True)
body = fields.Char('Body', translate=True, required=True)
lang = fields.Char('Language', help="Use this field to either force a specific language (ISO code) or dynamically "