diff options
| author | Jeremy Kersten <jke@odoo.com> | 2020-10-27 09:01:17 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2020-10-27 18:22:32 +0000 |
| commit | 112cf9088190606b85f60b420d50fbd1100e1f38 (patch) | |
| tree | 920b692cd49fd7b9c6139df08d2b8f92eeeafc6b | |
| parent | 5c79992f1f0f1b5a8ac4c1f464347abc10a6d8d8 (diff) | |
[FIX] website_mail_channel: _send_confirmation_email with company email
Public user by default don't have email. So when you try to subscribe to a
channel in public user (portal don't receive an email), the email cannot be
send and the user see a message:
"Unable to post message, please configure the sender's email address.
closes odoo/odoo#60865
X-original-commit: 7e40af524cc1b23abab3140377d993f3e93c5cf0
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
| -rw-r--r-- | addons/website_mail_channel/models/mail_channel.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/addons/website_mail_channel/models/mail_channel.py b/addons/website_mail_channel/models/mail_channel.py index 68c865d000b..89d72cd75b8 100644 --- a/addons/website_mail_channel/models/mail_channel.py +++ b/addons/website_mail_channel/models/mail_channel.py @@ -22,7 +22,9 @@ class MailGroup(models.Model): return headers def _send_confirmation_email(self, partner_ids, unsubscribe=False): - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + website = self.env['website'].get_current_website() + base_url = website.get_base_url() + route = "/groups/%(action)s/%(channel)s/%(partner)s/%(token)s" if unsubscribe: template = self.env.ref('website_mail_channel.mail_template_list_unsubscribe') @@ -41,9 +43,13 @@ class MailGroup(models.Model): 'partner': partner_id, 'token': token, }) - template.with_context(token_url=token_url).send_mail(self.id, + template.with_context(token_url=token_url).send_mail( + self.id, force_send=True, - email_values={'recipient_ids': [(4, partner_id)]} + email_values={ + 'recipient_ids': [(4, partner_id)], + 'email_from': website.company_id.email, + } ) return True |
