diff options
| author | Thibault Delavallée <tde@odoo.com> | 2021-04-21 11:57:13 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2021-04-23 08:00:43 +0000 |
| commit | 206685760abbc725765a1f4a5002c2a90abc0af8 (patch) | |
| tree | 38a8785fcbbb6f1e904b4b6a50b4de7e691b6fe0 /addons | |
| parent | 681eb75aeab02b9f904f85a3c60abd7c4a3c5269 (diff) | |
[FW][FIX] mail, various: fix document access link computation
Purpose of this commit is to fix computation of access link. In some cases
msg_vals modification leads to invalid URL computation, notably for frontend
or backend differentiation for target recipients.
Followup of odoo/odoo#63292 .
Task ID-2513724
COM PR odoo/odoo#69607
ENT PR odoo/enterprise#17849
X-Original-Commit: odoo/odoo@2015ef463c9ac7c7f89d543745c02a2d1528acf2
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/crm/models/crm_lead.py | 10 | ||||
| -rw-r--r-- | addons/hr_holidays/models/hr_leave.py | 6 | ||||
| -rw-r--r-- | addons/hr_holidays/models/hr_leave_allocation.py | 6 | ||||
| -rw-r--r-- | addons/portal/models/portal_mixin.py | 8 | ||||
| -rw-r--r-- | addons/project/models/project.py | 4 |
5 files changed, 17 insertions, 17 deletions
diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 0856177c29e..37cdf2a0cb7 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -1401,21 +1401,21 @@ class Lead(models.Model): """ Handle salesman recipients that can convert leads into opportunities and set opportunities as won / lost. """ groups = super(Lead, self)._notify_get_groups(msg_vals=msg_vals) - msg_vals = msg_vals or {} + local_msg_vals = dict(msg_vals or {}) self.ensure_one() if self.type == 'lead': - convert_action = self._notify_get_action_link('controller', controller='/lead/convert', **msg_vals) + convert_action = self._notify_get_action_link('controller', controller='/lead/convert', **local_msg_vals) salesman_actions = [{'url': convert_action, 'title': _('Convert to opportunity')}] else: - won_action = self._notify_get_action_link('controller', controller='/lead/case_mark_won', **msg_vals) - lost_action = self._notify_get_action_link('controller', controller='/lead/case_mark_lost', **msg_vals) + won_action = self._notify_get_action_link('controller', controller='/lead/case_mark_won', **local_msg_vals) + lost_action = self._notify_get_action_link('controller', controller='/lead/case_mark_lost', **local_msg_vals) salesman_actions = [ {'url': won_action, 'title': _('Won')}, {'url': lost_action, 'title': _('Lost')}] if self.team_id: - custom_params = dict(msg_vals, res_id=self.team_id.id, model=self.team_id._name) + custom_params = dict(local_msg_vals, res_id=self.team_id.id, model=self.team_id._name) salesman_actions.append({ 'url': self._notify_get_action_link('view', **custom_params), 'title': _('Sales Team Settings') diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index fbf20ee87af..e3121f4532b 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -1220,15 +1220,15 @@ class HolidaysRequest(models.Model): """ Handle HR users and officers recipients that can validate or refuse holidays directly from email. """ groups = super(HolidaysRequest, self)._notify_get_groups(msg_vals=msg_vals) - msg_vals = msg_vals or {} + local_msg_vals = dict(msg_vals or {}) self.ensure_one() hr_actions = [] if self.state == 'confirm': - app_action = self._notify_get_action_link('controller', controller='/leave/validate', **msg_vals) + app_action = self._notify_get_action_link('controller', controller='/leave/validate', **local_msg_vals) hr_actions += [{'url': app_action, 'title': _('Approve')}] if self.state in ['confirm', 'validate', 'validate1']: - ref_action = self._notify_get_action_link('controller', controller='/leave/refuse', **msg_vals) + ref_action = self._notify_get_action_link('controller', controller='/leave/refuse', **local_msg_vals) hr_actions += [{'url': ref_action, 'title': _('Refuse')}] holiday_user_group_id = self.env.ref('hr_holidays.group_hr_holidays_user').id diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index b93514953b9..346b9e1d6b2 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -670,15 +670,15 @@ class HolidaysAllocation(models.Model): """ Handle HR users and officers recipients that can validate or refuse holidays directly from email. """ groups = super(HolidaysAllocation, self)._notify_get_groups(msg_vals=msg_vals) - msg_vals = msg_vals or {} + local_msg_vals = dict(msg_vals or {}) self.ensure_one() hr_actions = [] if self.state == 'confirm': - app_action = self._notify_get_action_link('controller', controller='/allocation/validate', **msg_vals) + app_action = self._notify_get_action_link('controller', controller='/allocation/validate', **local_msg_vals) hr_actions += [{'url': app_action, 'title': _('Approve')}] if self.state in ['confirm', 'validate', 'validate1']: - ref_action = self._notify_get_action_link('controller', controller='/allocation/refuse', **msg_vals) + ref_action = self._notify_get_action_link('controller', controller='/allocation/refuse', **local_msg_vals) hr_actions += [{'url': ref_action, 'title': _('Refuse')}] holiday_user_group_id = self.env.ref('hr_holidays.group_hr_holidays_user').id diff --git a/addons/portal/models/portal_mixin.py b/addons/portal/models/portal_mixin.py index 8b8b25f610f..d2e9e83f094 100644 --- a/addons/portal/models/portal_mixin.py +++ b/addons/portal/models/portal_mixin.py @@ -63,13 +63,13 @@ class PortalMixin(models.AbstractModel): def _notify_get_groups(self, msg_vals=None): access_token = self._portal_ensure_token() groups = super(PortalMixin, self)._notify_get_groups(msg_vals=msg_vals) - msg_vals = msg_vals or {} + local_msg_vals = dict(msg_vals or {}) if access_token and 'partner_id' in self._fields and self['partner_id']: customer = self['partner_id'] - msg_vals['access_token'] = self.access_token - msg_vals.update(customer.signup_get_auth_param()[customer.id]) - access_link = self._notify_get_action_link('view', **msg_vals) + local_msg_vals['access_token'] = self.access_token + local_msg_vals.update(customer.signup_get_auth_param()[customer.id]) + access_link = self._notify_get_action_link('view', **local_msg_vals) new_group = [ ('portal_customer', lambda pdata: pdata['id'] == customer.id, { diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 8801fd6586d..d55d6b0278c 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -1215,7 +1215,7 @@ class Task(models.Model): access button to portal users and portal customers. If they are notified they should probably have access to the document. """ groups = super(Task, self)._notify_get_groups(msg_vals=msg_vals) - msg_vals = msg_vals or {} + local_msg_vals = dict(msg_vals or {}) self.ensure_one() project_user_group_id = self.env.ref('project.group_project_user').id @@ -1227,7 +1227,7 @@ class Task(models.Model): new_group = ('group_project_user', group_func, {}) if not self.user_id and not self.stage_id.fold: - take_action = self._notify_get_action_link('assign', **msg_vals) + take_action = self._notify_get_action_link('assign', **local_msg_vals) project_actions = [{'url': take_action, 'title': _('I take it')}] new_group[2]['actions'] = project_actions |
