def send_confirmation_email(self): """ An email confirming that the order has been confirmed and that we are waiting for the payment confirmation if we are really waiting for it. For setting a convention this email has to be sent by rendering the templates * Text: `<module_name>/emails/sale-confirmation-text.jinja` * HTML: `<module_name>/emails/sale-confirmation-html.jinja` """ EmailQueue = Pool().get('email.queue') Sale = Pool().get('sale.sale') Mail = Pool().get('mail.mail') if self.email_sent: return bcc_emails = self._get_bcc_emails() to_emails = self._get_receiver_email_address() if to_emails: sender = config.get('email', 'from') subject = self._get_subject_for_email() html_template, text_template = self._get_email_template_paths() template_context = self._get_email_template_context() email_message = Mail.render_email( from_email=sender, to=', '.join(to_emails), subject=subject, text_template=text_template, html_template=html_template, sale=self, **template_context ) EmailQueue.queue_mail( sender, to_emails + bcc_emails, email_message.as_string() ) Sale.write([self], { 'email_sent': True, })