Skip to content

Commit

Permalink
Déplace la mise à jour de 'send_to_commercial_partners_only' au-dessu…
Browse files Browse the repository at this point in the history
…s de obj.set_validated
  • Loading branch information
chloend committed Oct 3, 2024
1 parent 4f6e2aa commit 9a0dc36
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lemarche/tenders/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,15 +796,14 @@ def response_change(self, request, obj: Tender):
self.message_user(request, "Ce dépôt de besoin a été validé. Il sera envoyé en temps voulu :)")
return HttpResponseRedirect(".")
if request.POST.get("_validate_send_to_commercial_partners"):
obj.set_validated()
obj.send_to_commercial_partners_only = True
obj.set_validated()
if obj.amount_int > settings.BREVO_TENDERS_MIN_AMOUNT_TO_SEND:
api_brevo.create_deal(tender=obj, owner_email=request.user.email)
# we link deal(tender) with author contact
api_brevo.link_deal_with_contact_list(tender=obj)
self.message_user(request, "Ce dépôt de besoin a été synchronisé avec Brevo")
self.message_user(request, "Ce dépôt de besoin a été validé. Il sera envoyé en temps voulu :)")
obj.save()
return HttpResponseRedirect(".")
elif request.POST.get("_restart_tender"):
restart_send_tender_task(tender=obj)
Expand Down

0 comments on commit 9a0dc36

Please sign in to comment.