diff --git a/addons/auth_signup/data/auth_signup_data.xml b/addons/auth_signup/data/auth_signup_data.xml
index c8ded45916e..4d16b5e4951 100644
--- a/addons/auth_signup/data/auth_signup_data.xml
+++ b/addons/auth_signup/data/auth_signup_data.xml
@@ -9,8 +9,6 @@
-
- _usertemplate
diff --git a/addons/crm/tests/common.py b/addons/crm/tests/common.py
index 7a04e27ddb9..49b664e8b60 100644
--- a/addons/crm/tests/common.py
+++ b/addons/crm/tests/common.py
@@ -18,7 +18,6 @@ class TestCrm(TestMail):
cls.user_salesman_all = Users.create({
'name': 'Riton La Chignole',
'login': 'riton',
- 'alias_name': 'riton',
'email': 'riton.salesman_all@example.com',
'groups_id': [(6, 0, [user_group_employee.id, user_group_salesman_all.id])]
})
diff --git a/addons/event/tests/common.py b/addons/event/tests/common.py
index 6e2f0406357..dbd142a08be 100644
--- a/addons/event/tests/common.py
+++ b/addons/event/tests/common.py
@@ -27,7 +27,6 @@ class TestEventCommon(common.TransactionCase):
self.user_eventuser = self.Users.with_context({'no_reset_password': True}).create({
'name': 'Armande EventUser',
'login': 'Armande',
- 'alias_name': 'armande',
'email': 'armande.eventuser@example.com',
'tz': 'Europe/Brussels',
'groups_id': [(6, 0, [self.group_employee_id, self.group_event_user_id])]
@@ -35,7 +34,6 @@ class TestEventCommon(common.TransactionCase):
self.user_eventmanager = self.Users.with_context({'no_reset_password': True}).create({
'name': 'Bastien EventManager',
'login': 'bastien',
- 'alias_name': 'bastien',
'email': 'bastien.eventmanager@example.com',
'tz': 'Europe/Brussels',
'groups_id': [(6, 0, [
diff --git a/addons/hr/models/mail_thread.py b/addons/hr/models/mail_thread.py
index d27cbbd2afc..06eec55240d 100644
--- a/addons/hr/models/mail_thread.py
+++ b/addons/hr/models/mail_thread.py
@@ -3,45 +3,34 @@
import logging
-from odoo import api, models
-from odoo.addons.mail.models.mail_thread import decode_header
-from odoo.tools import email_split
+from odoo import api, models, _
+from odoo.tools import decode_message_header, email_split
_logger = logging.getLogger(__name__)
+
class MailThread(models.AbstractModel):
_inherit = "mail.thread"
@api.model
- def message_route_verify(self, message, message_dict, route, update_author=True, assert_model=True, create_fallback=True, allow_private=False):
- res = super(MailThread, self).message_route_verify(message, message_dict, route, update_author, assert_model, create_fallback, allow_private)
+ def message_route_verify(self, message, message_dict, route,
+ update_author=True, assert_model=True,
+ create_fallback=True, allow_private=False,
+ drop_alias=False):
+ res = super(MailThread, self).message_route_verify(
+ message, message_dict, route,
+ update_author=update_author,
+ assert_model=assert_model,
+ create_fallback=create_fallback,
+ allow_private=allow_private,
+ drop_alias=drop_alias)
if res:
alias = route[4]
- email_from = decode_header(message, 'From')
+ email_from = decode_message_header(message, 'From')
message_id = message.get('Message-Id')
- # Identically equal to the definition in mail module because sub methods are local
- # variables and cannot be called with super
- def _create_bounce_email(body_html):
- bounce_to = decode_header(message, 'Return-Path') or email_from
- bounce_mail_values = {
- 'body_html': body_html,
- 'subject': 'Re: %s' % message.get('subject'),
- 'email_to': bounce_to,
- 'auto_delete': True,
- }
- bounce_from = self.env['ir.mail_server']._get_default_bounce_address()
- if bounce_from:
- bounce_mail_values['email_from'] = 'MAILER-DAEMON <%s>' % bounce_from
- self.env['mail.mail'].create(bounce_mail_values).send()
-
- def _warn(message):
- _logger.info('Routing mail with Message-Id %s: route %s: %s',
- message_id, route, message)
-
# Alias: check alias_contact settings for employees
-
if alias and alias.alias_contact == 'employees':
email_address = email_split(email_from)[0]
employee = self.env['hr.employee'].search([('work_email', 'ilike', email_address)], limit=1)
@@ -49,7 +38,7 @@ class MailThread(models.AbstractModel):
employee = self.env['hr.employee'].search([('user_id.email', 'ilike', email_address)], limit=1)
if not employee:
mail_template = self.env.ref('hr.mail_template_data_unknown_employee_email_address')
- _warn('alias %s does not accept unknown employees, skipping' % alias.alias_name)
- _create_bounce_email(mail_template.body_html)
+ self._routing_warn(_('alias %s does not accept unknown employees') % alias.alias_name, _('skipping'), message_id, route, False)
+ self._routing_create_bounce_email(email_from, mail_template.body_html, message)
return False
return res
diff --git a/addons/hr_holidays/tests/common.py b/addons/hr_holidays/tests/common.py
index 2d9f518b340..8134675266a 100644
--- a/addons/hr_holidays/tests/common.py
+++ b/addons/hr_holidays/tests/common.py
@@ -18,21 +18,18 @@ class TestHrHolidaysBase(common.TransactionCase):
self.user_hruser_id = Users.create({
'name': 'Armande HrUser',
'login': 'Armande',
- 'alias_name': 'armande',
'email': 'armande.hruser@example.com',
'groups_id': [(6, 0, [group_employee_id, self.ref('base.group_hr_user')])]
}).id
self.user_hrmanager_id = Users.create({
'name': 'Bastien HrManager',
'login': 'bastien',
- 'alias_name': 'bastien',
'email': 'bastien.hrmanager@example.com',
'groups_id': [(6, 0, [group_employee_id, self.ref('base.group_hr_manager')])]
}).id
self.user_employee_id = Users.create({
'name': 'David Employee',
'login': 'david',
- 'alias_name': 'david',
'email': 'david.employee@example.com',
'groups_id': [(6, 0, [group_employee_id])]
}).id
diff --git a/addons/mail/__init__.py b/addons/mail/__init__.py
index 175383c6644..72546813981 100644
--- a/addons/mail/__init__.py
+++ b/addons/mail/__init__.py
@@ -3,3 +3,4 @@
import models
import wizard
import controllers
+import tests.test_mail_model
diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml
index 874f83d9af1..3645ba2e337 100644
--- a/addons/mail/data/mail_data.xml
+++ b/addons/mail/data/mail_data.xml
@@ -39,6 +39,12 @@
catchall
+
+
+ mail.bounce.alias
+ bounce
+
+