1
0
forked from erp-dev/erp

feat: backfill external order image upgrade to beat schedule by 1 hour

This commit is contained in:
2026-03-31 18:10:24 +08:00
parent aff10b8925
commit 72840b7277
12 changed files with 1085 additions and 108 deletions

View File

@@ -83,6 +83,7 @@ def get_sales_items_by_customer(
merchant,
customer_id: int,
include_already_has_shipment: bool = False,
external_order_id: str | None = None,
) -> QuerySet[SalesItem]:
"""
通过客户ID查询对应销售品。
@@ -94,6 +95,15 @@ def get_sales_items_by_customer(
customer_id=customer_id,
)
if external_order_id:
from printing.models import PrintingJob
printing_job_ids = PrintingJob.objects.filter(
merchant=merchant,
printing_order__external_order_id=external_order_id,
).values_list("id", flat=True)
queryset = queryset.filter(printing_job_id__in=list(printing_job_ids))
if not include_already_has_shipment:
queryset = queryset.filter(shipment__isnull=True)