Repository: saleor/saleor

Issue:
Incorrect filter name in voucher filters for old dashboard
In filters for old dashboard we use:

```
DISCOUNT_TYPE_CHOICES = (
    ("fixed", pgettext_lazy("Sale type filter choice", "USD")),
    ("percentage", pgettext_lazy("Sale type filter choice", "%")),
)
```

In model, we store this information in `discount_value_type` field. In `discount_type` field, we have information about voucher type e.g. `ENTIRE_ORDER`, `SPECIFIC_PRODUCT`, `SHIPPING`


Discussion:
@fowczarek I would like to take this up. Can you please share where can I find the documentation on the data structure and relevant files.
I really like the product, really fast. (Almost felt like a static site). 
Thanks.
@ChakshuGautam  
In model(saleor/discount/models.py) we have Voucher definition. 
Voucher has  fields:
- `type` has the information about voucher type e.g `ENTIRE_ORDER`, `SPECIFIC_PRODUCT`, `SHIPPING`
- `discount_value_type` has the information it's fixed or percentage voucher. 

In dashboard1.0 filters we have an invalid `discount type` choice fields. 
![image](https://user-images.githubusercontent.com/43955230/66921139-e4d27f00-f024-11e9-81b3-c2238d5efb92.png)

In this place, we should filter by voucher `type` not by `discount_value_type`


Resolving patch:
diff --git a/saleor/dashboard/discount/filters.py b/saleor/dashboard/discount/filters.py
--- a/saleor/dashboard/discount/filters.py
+++ b/saleor/dashboard/discount/filters.py
@@ -34,11 +34,20 @@
     ),
 }
 
-DISCOUNT_TYPE_CHOICES = (
+DISCOUNT_VALUE_TYPE_CHOICES = (
     ("fixed", pgettext_lazy("Sale type filter choice", "USD")),
     ("percentage", pgettext_lazy("Sale type filter choice", "%")),
 )
 
+VOUCHER_TYPE_CHOICES = (
+    ("shipping", pgettext_lazy("Voucher type filter choice", "Shipping")),
+    ("entire_order", pgettext_lazy("Voucher type filter choice", "Entire Order")),
+    (
+        "specific_product",
+        pgettext_lazy("Voucher type filter choice", "Specific Product"),
+    ),
+)
+
 
 def filter_by_date_range(queryset, name, value):
     q = Q()
@@ -63,7 +72,7 @@ class SaleFilter(SortedFilterSet):
     )
     type = ChoiceFilter(
         label=pgettext_lazy("Sale list filter label", "Discount type"),
-        choices=DISCOUNT_TYPE_CHOICES,
+        choices=DISCOUNT_VALUE_TYPE_CHOICES,
         empty_label=pgettext_lazy("Filter empty choice label", "All"),
         widget=forms.Select,
     )
@@ -100,14 +109,21 @@ class VoucherFilter(SortedFilterSet):
         lookup_expr="icontains",
     )
     type = ChoiceFilter(
+        field_name="type",
+        label=pgettext_lazy("Voucher list type filter label", "Voucher type"),
+        choices=VOUCHER_TYPE_CHOICES,
+        empty_label=pgettext_lazy("Filter empty choice label", "All"),
+        widget=forms.Select,
+    )
+    discount_value_type = ChoiceFilter(
         field_name="discount_value_type",
-        label=pgettext_lazy("Sale list is sale type filter label", "Discount type"),
-        choices=DISCOUNT_TYPE_CHOICES,
+        label=pgettext_lazy("Voucher list is sale type filter label", "Discount type"),
+        choices=DISCOUNT_VALUE_TYPE_CHOICES,
         empty_label=pgettext_lazy("Filter empty choice label", "All"),
         widget=forms.Select,
     )
     discount_value = RangeFilter(
-        label=pgettext_lazy("Sale list filter label", "Discount_value")
+        label=pgettext_lazy("Voucher list filter label", "Discount_value")
     )
     date = DateFromToRangeFilter(
         label=pgettext_lazy("Voucher list sorting filter label", "Period of validity"),
diff --git a/saleor/dashboard/discount/forms.py b/saleor/dashboard/discount/forms.py
--- a/saleor/dashboard/discount/forms.py
+++ b/saleor/dashboard/discount/forms.py
@@ -101,7 +101,7 @@ class Meta:
             "currency",
         ]
         labels = {
-            "type": pgettext_lazy("Discount type", "Discount type"),
+            "type": pgettext_lazy("Voucher type", "Voucher type"),
             "name": pgettext_lazy("Item name", "Name"),
             "code": pgettext_lazy("Coupon code", "Code"),
             "usage_limit": pgettext_lazy("Usage limit", "Usage limit"),


Test patch: