Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update schema and remove unneeded field

NyanKiyoshid28c53c47607
diff --git a/saleor/dashboard/forms.py b/saleor/dashboard/forms.py
index a7cdbe0c73..08ff609282 100644
--- a/saleor/dashboard/forms.py
+++ b/saleor/dashboard/forms.py
@@ -41,7 +41,6 @@ class MoneyModelForm(forms.ModelForm):
# Preserve the currency value
setattr(self.instance, f"{field_name}_amount", None)
else:
- print(field_name, field_name, value)
setattr(self.instance, field_name, value)
return super(MoneyModelForm, self).save(commit=commit)
diff --git a/saleor/dashboard/shipping/forms.py b/saleor/dashboard/shipping/forms.py
index 45e8b1f1c5..653a6d7d5f 100644
--- a/saleor/dashboard/shipping/forms.py
+++ b/saleor/dashboard/shipping/forms.py
@@ -249,9 +249,7 @@ class WeightShippingMethodForm(MoneyModelForm):
self.fields["minimum_order_weight"].widget.attrs["placeholder"] = "0"
def clean_minimum_order_weight(self):
- return self.cleaned_data["minimum_order_weight"] or zero_money(
- currency=self.instance.currency
- )
+ return self.cleaned_data["minimum_order_weight"] or 0
def clean(self):
data = super().clean()
diff --git a/saleor/graphql/discount/mutations.py b/saleor/graphql/discount/mutations.py
index 1a33e07db1..aae1e62551 100644
--- a/saleor/graphql/discount/mutations.py
+++ b/saleor/graphql/discount/mutations.py
@@ -116,12 +116,6 @@ class VoucherInput(graphene.InputObjectType):
name="categories",
)
min_amount_spent = Decimal(
- description=(
- "Deprecated: use minSpentAmount instead."
- "Min purchase amount required to apply the voucher."
- )
- )
- min_spent_amount = Decimal(
description="Min purchase amount required to apply the voucher."
)
min_checkout_items_quantity = graphene.Int(
@@ -164,12 +158,11 @@ class VoucherCreate(ModelMutation):
if voucher_type == VoucherTypeEnum.VALUE:
data["type"] = VoucherTypeEnum.ENTIRE_ORDER.value
- # Deprecated field
- min_spent_amount = data.pop("min_amount_spent", None)
- if min_spent_amount is not None:
- data["min_spent_amount"] = min_spent_amount
-
cleaned_input = super().clean_input(info, instance, data)
+
+ min_spent_amount = cleaned_input.pop("min_amount_spent", None)
+ if min_spent_amount is not None:
+ cleaned_input["min_spent_amount"] = min_spent_amount
return cleaned_input
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 00a26bf0ef..c1dfe6180a 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -2879,9 +2879,7 @@ type ProductVariantCreate {
input ProductVariantCreateInput {
attributes: [AttributeValueInput]!
costPrice: Decimal
- costPriceAmount: Decimal
priceOverride: Decimal
- priceOverrideAmount: Decimal
sku: String
quantity: Int
trackInventory: Boolean
@@ -2897,9 +2895,7 @@ type ProductVariantDelete {
input ProductVariantInput {
attributes: [AttributeValueInput]
costPrice: Decimal
- costPriceAmount: Decimal
priceOverride: Decimal
- priceOverrideAmount: Decimal
sku: String
quantity: Int
trackInventory: Boolean
@@ -3160,11 +3156,8 @@ type ShippingPriceDelete {
input ShippingPriceInput {
name: String
price: Decimal
- priceAmount: Decimal
minimumOrderPrice: Decimal
- minimumOrderPriceAmount: Decimal
maximumOrderPrice: Decimal
- maximumOrderPriceAmount: Decimal
minimumOrderWeight: WeightScalar
maximumOrderWeight: WeightScalar
type: ShippingMethodTypeEnum
@@ -3681,7 +3674,6 @@ input VoucherInput {
collections: [ID]
categories: [ID]
minAmountSpent: Decimal
- minSpentAmount: Decimal
minCheckoutItemsQuantity: Int
countries: [String]
applyOncePerOrder: Boolean
diff --git a/tests/dashboard/test_shipping.py b/tests/dashboard/test_shipping.py
index ab7e5fd357..f1d6013537 100644
--- a/tests/dashboard/test_shipping.py
+++ b/tests/dashboard/test_shipping.py
@@ -111,7 +111,8 @@ def test_price_shipping_method_form(shipping_method, min_price, max_price, resul
def test_weight_shipping_method_form(min_weight, max_weight, result):
data = {
"name": "Name",
- "price": 10,
+ "price_0": 10,
+ "price_1": "USD",
"minimum_order_weight": min_weight,
"maximum_order_weight": max_weight,
}