Skip to content

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

Merge pull request #7114 from mirumee/SALEOR-2542-error-decode-id

Marcin Gębala8d230e2befd6
diff --cc CHANGELOG.md
index ac431153df,d2ab7176ac..5a7a61eabc
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -48,13 -46,8 +48,14 @@@ All notable, unreleased changes to thi
- Fix dataloader for fetching checkout info - #7084 by @IKarbowiak
- Update also draft order line total price after getting the unit price from plugin - #7080 by @IKarbowiak
- Fix failing product tasks when instances are removed - #7092 by @IKarbowiak
+ - Catch invalid object ID and raise ValidationError - #7114 by @d-wysocki
- Update GraphQL endpoint to only match exactly `/graphql/` without trailing characters - #7117 by @IKarbowiak
+- Fix failing export when exporting attribute without values - #7131 by @IKarbowiak
+- Extend Vatlayer functionalities - #7101 by @korycins:
+ - Allow users to enter a list of exceptions (country ISO codes) that will use the source country rather than the destination country for tax purposes.
+ - Allow users to enter a list of countries for which no VAT will be added.
+- Fix incorrect payment data for klarna - #7150 by @IKarbowiak
+- Drop deleted images from storage - #7129 by @IKarbowiak
### Breaking
- Multichannel MVP: Multicurrency - #6242 by @fowczarek @d-wysocki
diff --cc saleor/graphql/product/resolvers.py
index 7adda5c9af,16e4bb9d0e..8cbaea0612
--- a/saleor/graphql/product/resolvers.py
+++ b/saleor/graphql/product/resolvers.py
@@@ -115,9 -113,13 +116,12 @@@ def resolve_product_variants
visible_products = visible_products.annotate_visible_in_listings(
channel_slug
).exclude(visible_in_listings=False)
-
- qs = models.ProductVariant.objects.filter(product__id__in=visible_products)
+ qs = qs.filter(product__in=visible_products).available_in_channel(channel_slug)
if ids:
- db_ids = [get_database_id(info, node_id, "ProductVariant") for node_id in ids]
+ db_ids = [
+ from_global_id_or_error(node_id, only_type="ProductVariant")[1]
+ for node_id in ids
+ ]
qs = qs.filter(pk__in=db_ids)
return ChannelQsContext(qs=qs, channel_slug=channel_slug)
diff --cc saleor/graphql/product/schema.py
index 03b8bdf169,2decedbd35..14ef0794f8
--- a/saleor/graphql/product/schema.py
+++ b/saleor/graphql/product/schema.py
@@@ -348,13 -349,9 +349,13 @@@ class ProductQueries(graphene.ObjectTyp
if channel is None and not is_staff:
channel = get_default_channel_slug_or_graphql_error()
if id:
- _, id = graphene.Node.from_global_id(id)
+ _, id = from_global_id_or_error(id)
variant = resolve_variant_by_id(
- info, id, channel_slug=channel, requestor=requestor
+ info,
+ id,
+ channel_slug=channel,
+ requestor=requestor,
+ requestor_has_access_to_all=is_staff,
)
else:
variant = resolve_product_variant_by_sku(
diff --cc saleor/graphql/product/types/products.py
index 4c9e4020cf,4128a8b0ca..76b5562d0d
--- a/saleor/graphql/product/types/products.py
+++ b/saleor/graphql/product/types/products.py
@@@ -61,15 -58,11 +62,11 @@@ from ...translations.types import
ProductTranslation,
ProductVariantTranslation,
)
- from ...utils import (
- get_database_id,
- get_user_country_context,
- get_user_or_app_from_context,
- )
+ from ...utils import get_user_country_context, get_user_or_app_from_context
from ...utils.filters import reporting_period_to_date
from ...warehouse.dataloaders import (
- AvailableQuantityByProductVariantIdAndCountryCodeLoader,
- StocksWithAvailableQuantityByProductVariantIdAndCountryCodeLoader,
+ AvailableQuantityByProductVariantIdCountryCodeAndChannelSlugLoader,
+ StocksWithAvailableQuantityByProductVariantIdCountryCodeAndChanneLoader,
)
from ...warehouse.types import Stock
from ..dataloaders import (