[FIX] mail: fix use of resend wizard when user are in failure
The user right to edit partners was handled in order to set email fields as readonly If a user is in the failed recipient, we need to check that the urrent user also has right to write on users
This commit is contained in:
@@ -29,7 +29,6 @@ class MailResendMessage(models.TransientModel):
|
||||
if message_id:
|
||||
mail_message_id = self.env['mail.message'].browse(message_id)
|
||||
notification_ids = mail_message_id.notification_ids.filtered(lambda notif: notif.email_status in ('exception', 'bounce'))
|
||||
partner_readonly = not self.env['res.partner'].check_access_rights('write', raise_exception=False)
|
||||
partner_ids = [(0, 0,
|
||||
{
|
||||
"partner_id": notif.res_partner_id.id,
|
||||
@@ -39,6 +38,11 @@ class MailResendMessage(models.TransientModel):
|
||||
"message": notif.format_failure_reason(),
|
||||
}
|
||||
) for notif in notification_ids]
|
||||
has_user = any([notif.res_partner_id.user_ids for notif in notification_ids])
|
||||
if has_user:
|
||||
partner_readonly = not self.env['res.users'].check_access_rights('write', raise_exception=False)
|
||||
else:
|
||||
partner_readonly = not self.env['res.partner'].check_access_rights('write', raise_exception=False)
|
||||
rec['partner_readonly'] = partner_readonly
|
||||
rec['notification_ids'] = [(6, 0, notification_ids.ids)]
|
||||
rec['mail_message_id'] = mail_message_id.id
|
||||
|
||||
Reference in New Issue
Block a user