[FIX] mail: variable not referenced before assignment

In case of generic activity user type, if the referenced field does not exist
in the linked model, we should not raise an UnboundLocalError and use the
current user as a fallback case instead.

closes odoo/odoo#50802

X-original-commit: 554a7cc400b4e1d8cda835e445b152f146bb0003
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
This commit is contained in:
alt-odoo
2020-05-07 08:14:16 +00:00
parent e997bf14b3
commit a3049d1300
+1
View File
@@ -126,6 +126,7 @@ class ServerActions(models.Model):
if action.activity_date_deadline_range > 0:
vals['date_deadline'] = fields.Date.context_today(action) + relativedelta(**{action.activity_date_deadline_range_type: action.activity_date_deadline_range})
for record in records:
user = False
if action.activity_user_type == 'specific':
user = action.activity_user_id
elif action.activity_user_type == 'generic' and action.activity_user_field_name in record: