Add comprehensive analytics and VAT rate management
Introduced a full-featured analytics module for e-commerce business intelligence, including sales, product, customer, shipping, and review analytics, with API endpoints for dashboard and custom reports. Added VAT rate management: new VATRate model, admin interface, serializer, and API endpoints, and integrated VAT logic into Product and pricing calculations. Refactored configuration and admin code to support VAT rates, improved email notification tasks, and updated related serializers, views, and URLs for unified configuration and VAT management.
This commit is contained in:
@@ -12,7 +12,7 @@ from django.utils import timezone
|
||||
def delete_expired_orders():
|
||||
Order = apps.get_model('commerce', 'Order')
|
||||
|
||||
expired_orders = Order.objects.filter(status=Order.STATUS_CHOICES.CANCELLED, created_at__lt=timezone.now() - timezone.timedelta(hours=24))
|
||||
expired_orders = Order.objects.filter(status=Order.OrderStatus.CANCELLED, created_at__lt=timezone.now() - timezone.timedelta(hours=24))
|
||||
count = expired_orders.count()
|
||||
expired_orders.delete()
|
||||
return count
|
||||
@@ -30,10 +30,9 @@ def notify_zasilkovna_sended(order = None, user = None, **kwargs):
|
||||
print("Additional kwargs received in notify_order_sended:", kwargs)
|
||||
|
||||
send_email_with_context(
|
||||
user.email,
|
||||
recipients=user.email,
|
||||
subject="Your order has been shipped",
|
||||
template_name="emails/order_sended.txt",
|
||||
html_template_name="emails/order_sended.html",
|
||||
template_path="email/order_sended.html",
|
||||
context={
|
||||
"user": user,
|
||||
"order": order,
|
||||
@@ -52,10 +51,9 @@ def notify_Ready_to_pickup(order = None, user = None, **kwargs):
|
||||
print("Additional kwargs received in notify_order_sended:", kwargs)
|
||||
|
||||
send_email_with_context(
|
||||
user.email,
|
||||
subject="Your order has been shipped",
|
||||
template_name="emails/order_sended.txt",
|
||||
html_template_name="emails/order_sended.html",
|
||||
recipients=user.email,
|
||||
subject="Your order is ready for pickup",
|
||||
template_path="email/order_ready_pickup.html",
|
||||
context={
|
||||
"user": user,
|
||||
"order": order,
|
||||
@@ -75,10 +73,9 @@ def notify_order_successfuly_created(order = None, user = None, **kwargs):
|
||||
print("Additional kwargs received in notify_order_successfuly_created:", kwargs)
|
||||
|
||||
send_email_with_context(
|
||||
user.email,
|
||||
recipients=user.email,
|
||||
subject="Your order has been successfully created",
|
||||
template_name="emails/order_created.txt",
|
||||
html_template_name="emails/order_created.html",
|
||||
template_path="email/order_created.html",
|
||||
context={
|
||||
"user": user,
|
||||
"order": order,
|
||||
@@ -96,10 +93,9 @@ def notify_about_missing_payment(order = None, user = None, **kwargs):
|
||||
print("Additional kwargs received in notify_about_missing_payment:", kwargs)
|
||||
|
||||
send_email_with_context(
|
||||
user.email,
|
||||
recipients=user.email,
|
||||
subject="Payment missing for your order",
|
||||
template_name="emails/order_missing_payment.txt",
|
||||
html_template_name="emails/order_missing_payment.html",
|
||||
template_path="email/order_missing_payment.html",
|
||||
context={
|
||||
"user": user,
|
||||
"order": order,
|
||||
@@ -116,10 +112,9 @@ def notify_refund_items_arrived(order = None, user = None, **kwargs):
|
||||
print("Additional kwargs received in notify_refund_items_arrived:", kwargs)
|
||||
|
||||
send_email_with_context(
|
||||
user.email,
|
||||
recipients=user.email,
|
||||
subject="Your refund items have arrived",
|
||||
template_name="emails/order_refund_items_arrived.txt",
|
||||
html_template_name="emails/order_refund_items_arrived.html",
|
||||
template_path="email/order_refund_items_arrived.html",
|
||||
context={
|
||||
"user": user,
|
||||
"order": order,
|
||||
@@ -138,10 +133,9 @@ def notify_refund_accepted(order = None, user = None, **kwargs):
|
||||
print("Additional kwargs received in notify_refund_accepted:", kwargs)
|
||||
|
||||
send_email_with_context(
|
||||
user.email,
|
||||
recipients=user.email,
|
||||
subject="Your refund has been accepted",
|
||||
template_name="emails/order_refund_accepted.txt",
|
||||
html_template_name="emails/order_refund_accepted.html",
|
||||
template_path="email/order_refund_accepted.html",
|
||||
context={
|
||||
"user": user,
|
||||
"order": order,
|
||||
|
||||
Reference in New Issue
Block a user