diff --git a/addons/mail/models/mail_mail.py b/addons/mail/models/mail_mail.py
index 347836c095f..01dc0adc9a1 100644
--- a/addons/mail/models/mail_mail.py
+++ b/addons/mail/models/mail_mail.py
@@ -158,6 +158,17 @@ class MailMail(models.Model):
def action_retry(self):
self.filtered(lambda mail: mail.state == 'exception').mark_outgoing()
+ def action_open_document(self):
+ """ Opens the related record based on the model and ID """
+ self.ensure_one()
+ return {
+ 'res_id': self.res_id,
+ 'res_model': self.model,
+ 'target': 'current',
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ }
+
def mark_outgoing(self):
return self.write({'state': 'outgoing'})
diff --git a/addons/mail/views/mail_mail_views.xml b/addons/mail/views/mail_mail_views.xml
index 1b1cb862061..d599b404d5c 100644
--- a/addons/mail/views/mail_mail_views.xml
+++ b/addons/mail/views/mail_mail_views.xml
@@ -13,6 +13,11 @@
+
+
+