From a3049d13000fce63541207cc80d5239ddde02307 Mon Sep 17 00:00:00 2001 From: alt-odoo Date: Wed, 6 May 2020 14:57:35 +0000 Subject: [PATCH] [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) Signed-off-by: Alex Tuyls --- addons/mail/models/ir_actions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/mail/models/ir_actions.py b/addons/mail/models/ir_actions.py index 5c27db9a08a..9156baf136c 100644 --- a/addons/mail/models/ir_actions.py +++ b/addons/mail/models/ir_actions.py @@ -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: