_body_html1 = 'Fans of Pigs, unite !'
_body_html2 = 'I am angry !'
_attachments = [
- {'name': 'First', 'datas_fname': 'first.txt', 'datas': base64.b64encode('My first attachment'), 'res_model': 'dummy.model'},
- {'name': 'Second', 'datas_fname': 'second.txt', 'datas': base64.b64encode('My second attachment'), 'res_model': 'dummy.model'}
+ {'name': 'First', 'datas_fname': 'first.txt', 'datas': base64.b64encode('My first attachment'), 'res_model': 'mail.group', 'res_id': self.group_pigs_id},
+ {'name': 'Second', 'datas_fname': 'second.txt', 'datas': base64.b64encode('My second attachment'), 'res_model': 'mail.group', 'res_id': self.group_pigs_id}
]
_attachments_test = [('first.txt', 'My first attachment'), ('second.txt', 'My second attachment')]
# Test: mail.compose.message: attachments
# Test: mail.message: attachments
for attach in compose.attachment_ids:
- self.assertEqual(attach.res_model, 'dummy.model', 'mail.message attachment res_model through templat was overriden')
+ self.assertEqual(attach.res_model, 'mail.group', 'mail.message attachment res_model through templat was overriden')
self.assertEqual(attach.res_id, self.group_pigs_id, 'mail.message attachment res_id incorrect')
- self.assertIn((attach.name, base64.b64decode(attach.datas)), _attachments_test,
+ self.assertIn((attach.datas_fname, base64.b64decode(attach.datas)), _attachments_test,
'mail.message attachment name / data incorrect')
# ----------------------------------------
new_partner_ids = email_dict.pop('partner_ids', [])
post_values['partner_ids'] += [(4, partner_id) for partner_id in new_partner_ids]
new_attachment_ids = email_dict.pop('attachment_ids', [])
- post_values['attachments'] += new_attachment_ids
+ post_values['attachment_ids'] += [(4, attach_id) for attach_id in new_attachment_ids]
new_attachments = email_dict.pop('attachments', [])
post_values['attachments'] += new_attachments
post_values.update(email_dict)