示例#1
0
 def basequeryset(request, *args, **kwargs):
     current, start, end = getHorizon(request)
     return DistributionOrder.objects.all() \
       .filter(startdate__lte=end, enddate__gte=start) \
       .annotate(key=RawSQL("coalesce(item_id,'') || coalesce(origin_id,'') || coalesce(destination_id,'')", ())) \
       .distinct('key') \
       .order_by()   # Ordering isn't compatible with the distinct
示例#2
0
 def basequeryset(request, *args, **kwargs):
   current, start, end = getHorizon(request)
   return DistributionOrder.objects.all() \
     .filter(startdate__lte=end, enddate__gte=start) \
     .annotate(key=RawSQL("coalesce(item_id,'') || coalesce(origin_id,'') || coalesce(destination_id,'')", ())) \
     .distinct('key') \
     .order_by()   # Ordering isn't compatible with the distinct
示例#3
0
 def basequeryset(request, *args, **kwargs):
     current, start, end = getHorizon(request)
     return (PurchaseOrder.objects.all(
     ).filter(startdate__lte=end, enddate__gte=start).annotate(key=RawSQL(
         "coalesce(item_id,'') || coalesce(location_id,'') || coalesce(supplier_id,'')",
         (),
     )).distinct("key").order_by()
             )  # Ordering isn't compatible with the distinct
示例#4
0
 def basequeryset(request, args, kwargs):
   if args and args[0]:
     request.session['lasttab'] = 'plan'
     return Operation.objects.all()
   else:
     current, start, end = getHorizon(request)
     return Operation.objects.all().extra(
       where=['exists (select 1 from operationplan where operationplan.operation_id = operation.name and startdate <= %s and enddate >= %s)'],
       params=[end, start]
       )
示例#5
0
 def basequeryset(request, *args, **kwargs):
   if args and args[0]:
     request.session['lasttab'] = 'plan'
     return Operation.objects.all()
   else:
     current, start, end = getHorizon(request)
     return Operation.objects.all().extra(
       where=['exists (select 1 from operationplan where operationplan.operation_id = operation.name and startdate <= %s and enddate >= %s)'],
       params=[end, start]
       )
示例#6
0
 def basequeryset(request, *args, **kwargs):
     if args and args[0]:
         request.session["lasttab"] = "plan"
         return Operation.objects.filter(name=args[0])
     else:
         current, start, end = getHorizon(request)
         return Operation.objects.all().extra(
             where=[
                 "exists (select 1 from operationplan where operationplan.operation_id = operation.name and startdate <= %s and enddate >= %s)"
             ],
             params=[end, start],
         )
示例#7
0
 def basequeryset(request, *args, **kwargs):
     current, start, end = getHorizon(request)
     return DistributionOrder.objects.all() \
       .filter(startdate__lte=end, enddate__gte=start) \
       .distinct('item', 'origin', 'destination') \
       .order_by()   # Ordering isn't compatible with the distinct
示例#8
0
 def basequeryset(request, *args, **kwargs):
     current, start, end = getHorizon(request)
     return PurchaseOrder.objects.all() \
       .filter(startdate__lte=end, enddate__gte=start) \
       .distinct('item', 'supplier', 'location') \
       .order_by()   # Ordering isn't compatible with the distinct