diff --git a/mail_parent_recipient/models/mail_template.py b/mail_parent_recipient/models/mail_template.py index 7c6c0487..8de8068e 100644 --- a/mail_parent_recipient/models/mail_template.py +++ b/mail_parent_recipient/models/mail_template.py @@ -10,11 +10,10 @@ class MailTemplate(models.Model): @api.multi def generate_recipients(self, results, res_ids): - """ - Modify the code that set the default recipient in an email to the first - partner having an email set following the parents tree. - If no parent with an email is found, - it reverts to the popup asking to set an email for the current partner + """Use partner's parent email as recipient. + + Walk up the hierarchy of recipient partners via `parent_id` + and pick the 1st one having an email. """ results = super(MailTemplate, self).generate_recipients( results, diff --git a/mail_parent_recipient/readme/CREDITS.rst b/mail_parent_recipient/readme/CREDITS.rst index ea08384b..f5cc070c 100644 --- a/mail_parent_recipient/readme/CREDITS.rst +++ b/mail_parent_recipient/readme/CREDITS.rst @@ -1,4 +1,3 @@ - The development of this module has been financially supported by: -* Camptocamp Thomas Nowicki +* Camptocamp diff --git a/mail_parent_recipient/readme/DESCRIPTION.rst b/mail_parent_recipient/readme/DESCRIPTION.rst index d8c106f8..f0420bc9 100644 --- a/mail_parent_recipient/readme/DESCRIPTION.rst +++ b/mail_parent_recipient/readme/DESCRIPTION.rst @@ -1,3 +1 @@ -This modules set the default recipient in an email to the first partner having -an email set following the parents tree. If no parent with an email is found, -it reverts to the popup asking to set an email for the current partner. +This modules add the fact to use partner's parent email as recipient. diff --git a/mail_parent_recipient/tests/test_mail_parent_recipient.py b/mail_parent_recipient/tests/test_mail_parent_recipient.py index 1d371574..a6823c94 100644 --- a/mail_parent_recipient/tests/test_mail_parent_recipient.py +++ b/mail_parent_recipient/tests/test_mail_parent_recipient.py @@ -77,10 +77,7 @@ class TestMailTemplate(TestMail): return recipients def test_1_mail_send_to_partner_no_mail(self): - """ - Mail should only send with company mail - even if is sended to partner_no_mail - """ + """Use company mail if recipient partner has no email.""" recipients = self.create_mail_composer(self.partner_no_mail.id) self.assertEqual(recipients.email, self.company_test.email) @@ -88,10 +85,7 @@ class TestMailTemplate(TestMail): self.assertNotEqual(recipients.email, self.partner_with_mail.email) def test_2_mail_send_to_partner_with_mail(self): - """ - Mail should only send with company mail - even if is sended to partner_with_mail - """ + """Use partner mail if recipient partner has an email.""" recipients = self.create_mail_composer(self.partner_with_mail.id) self.assertNotEqual(recipients.email, self.company_test.email) @@ -99,10 +93,8 @@ class TestMailTemplate(TestMail): self.assertEqual(recipients.email, self.partner_with_mail.email) def test_3_mail_send_to_company_test(self): - """ - Mail should only send with company mail - """ - recipients = self.create_mail_composer(self.partner_no_mail.id) + """Use company mail if recipient is the company.""" + recipients = self.create_mail_composer(self.company_test.id) self.assertEqual(recipients.email, self.company_test.email) self.assertNotEqual(recipients.email, self.partner_no_mail.email)