forked from erp-dev/erp
feat: backfill external order image upgrade to beat schedule by 1 hour
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user