only send to customer for credit notes linked to a user object
This commit is contained in:
parent
c0f2478819
commit
88cb7934c1
|
@ -87,8 +87,8 @@ def do_work():
|
||||||
creditnote.pdf.save(creditnote.filename, File(pdffile))
|
creditnote.pdf.save(creditnote.filename, File(pdffile))
|
||||||
creditnote.save()
|
creditnote.save()
|
||||||
|
|
||||||
# check if we need to send out any creditnotes (only where pdf has been generated)
|
# check if we need to send out any creditnotes (only where pdf has been generated and only for creditnotes linked to a user)
|
||||||
for creditnote in CreditNote.objects.filter(sent_to_customer=False).exclude(pdf=''):
|
for creditnote in CreditNote.objects.filter(sent_to_customer=False).exclude(pdf='').exclude(user=None):
|
||||||
# send the email
|
# send the email
|
||||||
if add_creditnote_email(creditnote=creditnote):
|
if add_creditnote_email(creditnote=creditnote):
|
||||||
logger.info('OK: Creditnote email to %s added' % creditnote.user.email)
|
logger.info('OK: Creditnote email to %s added' % creditnote.user.email)
|
||||||
|
|
Loading…
Reference in a new issue