Refactor email templates and add notification tasks
Moved email templates to a unified 'email' directory and added new base, header, and footer templates for emails. Implemented notification tasks in commerce for various order and refund events, and updated Carrier model to trigger notifications on shipping state changes.
This commit is contained in:
@@ -10,6 +10,7 @@ from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from weasyprint import HTML
|
||||
import os
|
||||
|
||||
from backend.commerce.tasks import notify_order_sended
|
||||
from configuration.models import ShopConfiguration
|
||||
from thirdparty.zasilkovna.models import ZasilkovnaPacket
|
||||
from thirdparty.stripe.models import StripeModel
|
||||
@@ -243,9 +244,16 @@ class Carrier(models.Model):
|
||||
self.returning = False
|
||||
self.save()
|
||||
|
||||
elif self.shipping_method == self.SHIPPING.STORE:
|
||||
self.state = self.STATE.READY_TO_PICKUP
|
||||
self.save()
|
||||
|
||||
else:
|
||||
raise ValidationError("Tato metoda dopravy nepodporuje objednání přepravy.")
|
||||
|
||||
|
||||
notify_order_sended.delay(order=self.orders.first(), user=self.orders.first().user)
|
||||
|
||||
#... další logika pro jiné způsoby dopravy
|
||||
#TODO: přidat notifikace uživateli, jak pro zásilkovnu, tak pro vyzvednutí v obchodě!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user