send email to manager if coop has no email

This commit is contained in:
Diego Calvo
2021-03-15 13:07:47 +01:00
parent 23b78dd11a
commit fc7e80eb5c

View File

@@ -290,7 +290,7 @@ def purchase_email(request):
return Response({"error": "Invalid value for product"}, status=status.HTTP_406_NOT_ACCEPTABLE) return Response({"error": "Invalid value for product"}, status=status.HTTP_406_NOT_ACCEPTABLE)
# check company.email # check company.email
if company.email is None: if company.email is None:
return Response({"error": "Related compay has no contact email address"}, status=status.HTTP_406_NOT_ACCEPTABLE) company.email = managing_user.email
try: try:
# send email to company # send email to company
company_message = render_to_string('purchase_notification_v2.html', { company_message = render_to_string('purchase_notification_v2.html', {