Skip to content

Commit

Permalink
[FIX] A bit more complex do send emails now, the other method was rem…
Browse files Browse the repository at this point in the history
…oving attachments
  • Loading branch information
danimaribeiro committed Aug 2, 2019
1 parent 99717bf commit 810ccf0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions br_account_einvoice/models/invoice_eletronic.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,15 @@ def send_email_nfe(self):
atts = self._find_attachment_ids_email()
_logger.info('Sending e-mail for e-doc %s (number: %s)' % (
self.id, self.numero))
self.invoice_id.message_post_with_template(
mail.id, attachment_ids=[(6, 0, atts + mail.attachment_ids.ids)])

values = mail.generate_email([self.invoice_id.id])[self.invoice_id.id]
subject = values.pop('subject')
values.pop('body')
values.pop('attachment_ids')
self.invoice_id.message_post(
body=values['body_html'], subject=subject,
message_type='email', subtype='mt_comment',
attachment_ids=atts + mail.attachment_ids.ids, **values)

@api.multi
def send_email_nfe_queue(self):
Expand Down

0 comments on commit 810ccf0

Please sign in to comment.