Mail: Fix fetching of customers

This commit is contained in:
Raphael Michel
2021-05-07 17:05:02 +02:00
parent a4ccf07bfb
commit 4cbec46f3e

View File

@@ -352,9 +352,6 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
if user:
user = User.objects.get(pk=user)
if customer:
customer = Customer.objects.get(pk=customer)
if event:
with scopes_disabled():
event = Event.objects.get(id=event)
@@ -369,9 +366,11 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
backend = get_connection(fail_silently=False)
cm = lambda: scopes_disabled() # noqa
with cm():
if customer:
customer = Customer.objects.get(pk=customer)
log_target = user or customer
with cm():
if event:
if order:
try: