Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Prevent removing translation from OrderLine when translatedName = name (#17504)
delemeatord7247f26d645
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f5f6b95901..4718a38b11 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -92,6 +92,7 @@ All notable, unreleased changes to this project will be documented in this file.- Use denormalized base prices during order update - #17160 by @zedzior- `UNCONFIRMED` orders will never refresh its base prices- `DRAFT` orders will refresh its base prices after default 24 hours+- Fix bug which, in some cases, caused product name translations to be empty in order lines - #17504 by @delemeator- Added a warning to metadata input fields in GraphQL schema informing to never store sensitive data.This ensures user awareness of potential security policy violations and compliance risks of storingcertain types of data. - #17506 by @NyanKiyoshidiff --git a/saleor/checkout/complete_checkout.py b/saleor/checkout/complete_checkout.pyindex 5e63c209ae..0cef6d0fab 100644--- a/saleor/checkout/complete_checkout.py+++ b/saleor/checkout/complete_checkout.py@@ -290,12 +290,6 @@ def _create_line_for_order(translated_product_name = products_translation.get(product.id, "")translated_variant_name = variants_translation.get(variant.id, "")- if translated_product_name == product_name:- translated_product_name = ""-- if translated_variant_name == variant_name:- translated_variant_name = ""-# the price with sale and discounts applied - base price that is used for# total price calculationbase_unit_price = calculate_base_line_unit_price(line_info=checkout_line_info)diff --git a/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py b/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.pyindex d767f426c0..4c5cd8da54 100644--- a/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py+++ b/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py@@ -2744,6 +2744,58 @@ def test_order_from_checkout_with_transaction_empty_product_translation(assert order_line.translated_variant_name == ""+def test_order_from_checkout_with_translation_equal_name(+ app_api_client,+ site_settings,+ checkout_with_item,+ permission_handle_checkouts,+ permission_manage_checkouts,+ address,+ shipping_method,+):+ # given+ checkout = checkout_with_item+ checkout.shipping_address = address+ checkout.shipping_method = shipping_method+ checkout.billing_address = address+ checkout.save()++ checkout_line = checkout.lines.first()+ checkout_line_variant = checkout_line.variant+ checkout_line_product = checkout_line_variant.product+ checkout_line_product.name = "Product name"+ checkout_line_product.save()+ checkout_line_variant.name = "Variant name"+ checkout_line_variant.save()+ product_translation = checkout_line_product.translations.create(+ language_code=checkout.language_code, name=checkout_line_product.name+ )+ variant_translation = checkout_line_variant.translations.create(+ language_code=checkout.language_code, name=checkout_line_variant.name+ )++ variables = {+ "id": graphene.Node.to_global_id("Checkout", checkout.pk),+ }++ # when+ response = app_api_client.post_graphql(+ MUTATION_ORDER_CREATE_FROM_CHECKOUT,+ variables,+ permissions=[permission_handle_checkouts, permission_manage_checkouts],+ )++ # then+ content = get_graphql_content(response)+ data = content["data"]["orderCreateFromCheckout"]+ assert not data["errors"]++ order = Order.objects.first()+ order_line = order.lines.first()+ assert order_line.translated_product_name == product_translation.name+ assert order_line.translated_variant_name == variant_translation.name++def test_order_from_checkout_order_status_changed_after_creation(checkout_with_item_total_0,customer_user,