Пример #1
0
 def get_objects(self):
     (start, end) = to_datetime_range(self.start_date, self.end_date)
     queryset = OrderLine.objects.filter(created_on__range=(start, end))
     supplier = self.options.get("supplier")
     types = self.options.get("order_line_type")
     order_status = self.options.get("order_status")
     filters = Q()
     if supplier:
         filters &= Q(supplier__in=supplier)
     if types:
         filters &= Q(type__in=types)
     if order_status:
         filters &= Q(order__status__in=order_status)
     return queryset.filter(filters).order_by("created_on")
Пример #2
0
    def get_objects(self):
        (start, end) = to_datetime_range(self.start_date, self.end_date)
        queryset = Order.objects.filter(shop=self.shop,
                                        order_date__range=(start, end))
        creator = self.options.get("creator")
        orderer = self.options.get("orderer")
        customer = self.options.get("customer")
        filters = Q()
        if creator:
            filters &= Q(creator__in=creator)
        if orderer:
            filters &= Q(orderer__in=orderer)
        if customer:
            filters &= Q(customer__in=customer)

        return queryset.filter(filters).valid().paid().order_by("order_date")
Пример #3
0
    def get_objects(self):
        (start, end) = to_datetime_range(self.start_date, self.end_date)
        queryset = Order.objects.filter(shop=self.shop,
                                        order_date__range=(start, end))
        creator = self.options.get("creator")
        orderer = self.options.get("orderer")
        manufacturer = self.options.get("manufacturer")
        filters = Q()
        if creator:
            filters &= Q(creator__in=creator)
        if orderer:
            filters &= Q(orderer__in=orderer)
        if manufacturer:
            filters &= Q(lines__product__manufacturer__in=manufacturer)

        return queryset.filter(filters).valid().paid().order_by(
            "order_date").prefetch_related('lines__product')