Use language instance instead of code for get_email
This commit is contained in:
+1
-1
@@ -166,7 +166,7 @@ class Email(ModelSQL, ModelView):
|
||||
msg.attach(content)
|
||||
language = list(languages)[-1]
|
||||
for report in self.attachments:
|
||||
msg.attach(Attachment.get_mime(report, record, language))
|
||||
msg.attach(Attachment.get_mime(report, record, language.code))
|
||||
else:
|
||||
msg = content
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ class NotificationEmailTestCase(ModuleTestCase):
|
||||
Report = pool.get('ir.action.report')
|
||||
User = pool.get('res.user')
|
||||
NotificationEmail = pool.get('notification.email')
|
||||
Language = pool.get('ir.lang')
|
||||
|
||||
model, = Model.search([
|
||||
('model', '=', User.__name__),
|
||||
@@ -122,6 +123,7 @@ class NotificationEmailTestCase(ModuleTestCase):
|
||||
action_model, = Model.search([
|
||||
('model', '=', 'notification.email'),
|
||||
])
|
||||
en, = Language.search([('code', '=', 'en')])
|
||||
|
||||
action = Action(name="Notification Email", type='ir.action.report')
|
||||
action.save()
|
||||
@@ -157,7 +159,7 @@ class NotificationEmailTestCase(ModuleTestCase):
|
||||
user, = User.create([{'name': "Michael Scott", 'login': "msc"}])
|
||||
|
||||
msg = notification_email.get_email(
|
||||
user, FROM, ['Administrator <user@example.com>'], [], [], ['en'])
|
||||
user, FROM, ['Administrator <user@example.com>'], [], [], [en])
|
||||
|
||||
self.assertEqual(msg['From'], FROM)
|
||||
self.assertEqual(msg['Subject'], 'Notification Email')
|
||||
|
||||
Reference in New Issue
Block a user