[18.0][MIG] mail_visible_email#214
Conversation
This module will show actual to, cc and bcc headers used on incoming and outgoing mails.
| - The module mail_composer_bcc fundamentally changes the workings of the | ||
| \_send() method on mail.mail. In order not to have to support both | ||
| methods depending on whether mail_composer_bcc is installed or not, it | ||
| is easier to just make sure it is installed. |
There was a problem hiding this comment.
Right so yes in 18.0 this isn't true anymore, yet, that also thwarts the reason to not have a regular module and a glue module for the bcc addition.
| existing = message[fieldname] | ||
| if existing: | ||
| emails += existing.split(",") | ||
| return ",".join(list(set(emails))) |
There was a problem hiding this comment.
These abstractions make sense to me, why lose them upon migration?
| for mail in self.filtered(lambda r: r.state == "outgoing"): | ||
| vals = {} | ||
| for fname in ("email_to", "email_cc", "email_bcc"): | ||
| raw = mail[fname] |
There was a problem hiding this comment.
I'm just wondering if here, before super is called, these fields already all have their right values.
Because it seems like for example email_bcc is only filled upon calling _prepare_outgoing_list, which is part of super._send().
If it isn't, we can of course ourselves do what mail_composer_cc_bcc does to fill the fields:
partners_cc_bcc = self.recipient_cc_ids + self.recipient_bcc_ids
partner_to_ids = [r.id for r in self.recipient_ids if r not in partners_cc_bcc]
partner_to = self.env["res.partner"].browse(partner_to_ids)
email_to = format_emails(partner_to)
email_cc = format_emails_str(self.recipient_cc_ids)
email_bcc = [r.email for r in self.recipient_bcc_ids if r.email]
Or already sneakily call prepare_outgoing_list once to get the values, but then we'd have to mind the context change that the function does
|
|
||
| def _send( | ||
| self, | ||
| auto_commit=False, |
There was a problem hiding this comment.
Maybe we should take the opportunity of the migration to replace all the keyword arguments with **kwargs as none of these arguments is referenced in the overriding method and they are passed unchanged.
NL66278
left a comment
There was a problem hiding this comment.
👍 Looks good, one suggestion for an improvement on the original.
5f96b45 to
976b8b5
Compare
|
@tarteo At least for the BCC field, it's added to the How did you get the mail to send without an outgoing mail server? |
|
This PR has the |
976b8b5 to
30b5896
Compare



forwardport of OCA/social#1643