Repository: saleor/saleor

Issue:
GraphQL error: Expected a value of type "WeightUnitsEnum" but received: kg
### Steps to reproduce the problem
1. Change the default language in the storefront to Portuguese.
2. Go to Dashboard 2.0. The homepage runs a query which fetches `defaultWeightUnit` field.
This GraphQL request returns this error: `GraphQL error: Expected a value of type "WeightUnitsEnum" but received: kg`



Discussion:
This is also true for all other languages that have translations for any weight units (kg, oz, lb, g). In site settings when you change default weight unit to something else, the GraphQl error changes to '`... but received: lb/oz/g`'. For example in German:
[https://github.com/mirumee/saleor/blob/5b5ed728ef9d7fd4b50305f7367ca5c46fe4fcf6/locale/de/LC_MESSAGES/django.po#L605](https://github.com/mirumee/saleor/blob/5b5ed728ef9d7fd4b50305f7367ca5c46fe4fcf6/locale/de/LC_MESSAGES/django.po#L605)

Changing this from 'Kg' to 'kg' (or any translated line back to 'kg', 'oz' , etc) and recompiling messages fixes this GraphQL error for me,  but I suppose it should work with translated lines also? It is marked with `pgettext_lazy`:
[https://github.com/mirumee/saleor/blob/5b5ed728ef9d7fd4b50305f7367ca5c46fe4fcf6/saleor/core/weight.py#L26](https://github.com/mirumee/saleor/blob/5b5ed728ef9d7fd4b50305f7367ca5c46fe4fcf6/saleor/core/weight.py#L26) 

But from what I can see Dashboard 2.0 isn't translated yet, because even after changing language and getting these errors I have only English in there. But I assume that just reverting these lines back to non-translated state isn't a good fix.

Could you tell me if I am on the right track here: for that query to work with translation it must be added to graphql/translations.py?
Thank's for the clue! Enum values should be independent of the locale. I think we should get rid of `enum.Enum` occurrences and generate all enums for Graphene such as ones in `saleor/graphql/core/enums.py`. E.g. I quickly checked that everything works fine if I remove `WeightUnitsEnum` from `weights.py` and instead add this in `graphql/core/enums.py`:

```python
WeightUnitsEnum = graphene.Enum(
    'WeightUnitsEnum',
    [(str_to_enum(unit[0]), unit[0]) for unit in WeightUnits.CHOICES])
```



Resolving patch:
diff --git a/saleor/core/weight.py b/saleor/core/weight.py
--- a/saleor/core/weight.py
+++ b/saleor/core/weight.py
@@ -13,7 +13,6 @@
 different planets.
 """
 from decimal import Decimal
-from enum import Enum
 
 from django import forms
 from django.contrib.sites.models import Site
@@ -36,11 +35,6 @@ class WeightUnits:
         (GRAM, pgettext_lazy('Gram weight unit symbol', 'g'))]
 
 
-WeightUnitsEnum = Enum(
-    'WeightUnitsEnum',
-    {unit: unit for unit in WeightUnits.CHOICES})
-
-
 def zero_weight():
     """Represent the zero weight value."""
     return Weight(kg=0)
diff --git a/saleor/graphql/core/enums.py b/saleor/graphql/core/enums.py
--- a/saleor/graphql/core/enums.py
+++ b/saleor/graphql/core/enums.py
@@ -1,6 +1,7 @@
 import graphene
 
-from ...core import TaxRateType as CoreTaxRateType, weight
+from ...core import TaxRateType as CoreTaxRateType
+from ...core.weight import WeightUnits
 from ...core.permissions import MODELS_PERMISSIONS
 from .utils import str_to_enum
 
@@ -21,4 +22,6 @@ class ReportingPeriod(graphene.Enum):
         for codename in MODELS_PERMISSIONS])
 
 
-WeightUnitsEnum = graphene.Enum.from_enum(weight.WeightUnitsEnum)
+WeightUnitsEnum = graphene.Enum(
+    'WeightUnitsEnum',
+    [(str_to_enum(unit[0]), unit[0]) for unit in WeightUnits.CHOICES])


Test patch:
diff --git a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
--- a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
+++ b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
@@ -66923,12 +66923,12 @@ exports[`Storyshots Views / Shipping / Shipping zones list default 1`] = `
                       role="button"
                       tabindex="0"
                     >
-                      kg
+                      KG
                     </div>
                     <input
                       name="unit"
                       type="hidden"
-                      value="kg"
+                      value="KG"
                     />
                     <svg
                       aria-hidden="true"
@@ -67233,12 +67233,12 @@ exports[`Storyshots Views / Shipping / Shipping zones list loading 1`] = `
                       class="MuiSelect-select-id MuiSelect-selectMenu-id MuiSelect-disabled-id MuiInputBase-input-id MuiInput-input-id MuiInputBase-disabled-id MuiInput-disabled-id"
                       role="button"
                     >
-                      kg
+                      KG
                     </div>
                     <input
                       name="unit"
                       type="hidden"
-                      value="kg"
+                      value="KG"
                     />
                     <svg
                       aria-hidden="true"
@@ -67501,12 +67501,12 @@ exports[`Storyshots Views / Shipping / Shipping zones list no data 1`] = `
                       role="button"
                       tabindex="0"
                     >
-                      kg
+                      KG
                     </div>
                     <input
                       name="unit"
                       type="hidden"
-                      value="kg"
+                      value="KG"
                     />
                     <svg
                       aria-hidden="true"