python - How to Send CC email on send by email in sale Quotation, Should I use different keyword for email cc? -


i overloading get_mail_values method of mail.compose.message. have added email_cc field , expecting mail should go both recipients.

@api.multi     def get_mail_values(self, res_ids):         """generate values used send_mail create mail_messages         or mail_mails. """         self.ensure_one()         results = dict.fromkeys(res_ids, false)         rendered_values = {}         mass_mail_mode = self.composition_mode == 'mass_mail'          # render template-based value @ once         if mass_mail_mode , self.model:             rendered_values = self.render_message(res_ids)         # compute alias-based reply-to in batch         reply_to_value = dict.fromkeys(res_ids, none)         if mass_mail_mode , not self.no_auto_thread:             # reply_to_value = self.env['mail.thread'].with_context(thread_model=self.model).browse(res_ids).message_get_reply_to(default=self.email_from)             reply_to_value = self.env['mail.thread'].with_context(thread_model=self.model).message_get_reply_to(res_ids, default=self.email_from)          res_id in res_ids:             # static wizard (mail.message) values             mail_values = {                 'subject': self.subject,                 'body': self.body or '',                 'parent_id': self.parent_id , self.parent_id.id,                 'partner_ids': [partner.id partner in self.partner_ids],                 **'email_cc' : self.partner_ids_cc,**                 'attachment_ids': [attach.id attach in self.attachment_ids],                 'author_id': self.author_id.id,                 'email_from': self.email_from,                 'record_name': self.record_name,                 'no_auto_thread': self.no_auto_thread,                 'mail_server_id': self.mail_server_id.id,             }             # mass mailing: rendering override wizard static values             if mass_mail_mode , self.model:                 # keep copy unless requested, reset record name (avoid browsing records)                 mail_values.update(notification=not self.auto_delete_message, model=self.model, res_id=res_id, record_name=false)                 # auto deletion of mail_mail                 if self.auto_delete or self.template_id.auto_delete:                     mail_values['auto_delete'] = true                 # rendered values using template                 email_dict = rendered_values[res_id]                 mail_values['partner_ids'] += email_dict.pop('partner_ids', [])                 mail_values.update(email_dict)                 if not self.no_auto_thread:                     mail_values.pop('reply_to')                     if reply_to_value.get(res_id):                         mail_values['reply_to'] = reply_to_value[res_id]                 if self.no_auto_thread , not mail_values.get('reply_to'):                     mail_values['reply_to'] = mail_values['email_from']                 # mail_mail values: body -> body_html, partner_ids -> recipient_ids                 mail_values['body_html'] = mail_values.get('body', '')                 mail_values['recipient_ids'] = [(4, id) id in mail_values.pop('partner_ids', [])]                  # process attachments: should not encoded before being processed message_post / mail_mail create                 mail_values['attachments'] = [(name, base64.b64decode(enc_cont)) name, enc_cont in email_dict.pop('attachments', list())]                 attachment_ids = []                 attach_id in mail_values.pop('attachment_ids'):                     new_attach_id = self.env['ir.attachment'].browse(attach_id).copy({'res_model': self._name, 'res_id': self.id})                     attachment_ids.append(new_attach_id.id)                 mail_values['attachment_ids'] = self.env['mail.thread']._message_preprocess_attachments(                     mail_values.pop('attachments', []),                     attachment_ids, 'mail.message', 0)              results[res_id] = mail_values         return results 

as per conclusion mail.compose.message passing control mail.mail object , send method of mail.mail object responsible send mail normal recipients , cc recipient.

please suggest me doing mistakes?


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -