Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Stop gating return and exchange creation on having shipped

Damian Legawiec1e85768bfe0c
diff --git a/packages/dashboard/src/components/spree/order-post-sale-cards.tsx b/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
index 0e30956033..caca0af8d6 100644
--- a/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
+++ b/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
@@ -67,11 +67,7 @@ export function OrderExchangesCard({ order }: { order: Order }) {
variant="outline"
size="sm"
disabled={!canCreate}
- title={
- canCreate
- ? undefined
- : t('admin.pages.orders.detail.returns.empty_nothing_fulfilled')
- }
+ title={canCreate ? undefined : t('admin.pages.orders.detail.returns.empty_no_units')}
onClick={() => setCreating(true)}
>
<PlusIcon className="size-4" />
@@ -84,7 +80,7 @@ export function OrderExchangesCard({ order }: { order: Order }) {
<p className="text-sm text-muted-foreground">
{canCreate
? t('admin.pages.orders.detail.exchanges.empty')
- : t('admin.pages.orders.detail.returns.empty_nothing_fulfilled')}
+ : t('admin.pages.orders.detail.returns.empty_no_units')}
</p>
)}
{exchanges.map((exchange: Exchange) => (
diff --git a/packages/dashboard/src/components/spree/order-returns-card.tsx b/packages/dashboard/src/components/spree/order-returns-card.tsx
index 2357cd5bc1..6b5ffb4136 100644
--- a/packages/dashboard/src/components/spree/order-returns-card.tsx
+++ b/packages/dashboard/src/components/spree/order-returns-card.tsx
@@ -89,11 +89,7 @@ export function OrderReturnsCard({ order }: { order: Order }) {
variant="outline"
size="sm"
disabled={!canCreate}
- title={
- canCreate
- ? undefined
- : t('admin.pages.orders.detail.returns.empty_nothing_fulfilled')
- }
+ title={canCreate ? undefined : t('admin.pages.orders.detail.returns.empty_no_units')}
onClick={() => setCreating(true)}
>
<PlusIcon className="size-4" />
@@ -106,7 +102,7 @@ export function OrderReturnsCard({ order }: { order: Order }) {
<p className="text-sm text-muted-foreground">
{canCreate
? t('admin.pages.orders.detail.returns.empty')
- : t('admin.pages.orders.detail.returns.empty_nothing_fulfilled')}
+ : t('admin.pages.orders.detail.returns.empty_no_units')}
</p>
)}
{returns.map((returnRecord) => (
diff --git a/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx b/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
index 3f03312fa9..81cbed4fd1 100644
--- a/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
+++ b/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
@@ -29,8 +29,11 @@ export type FulfilledUnit = {
}
/**
- * Every fulfilled unit on the order, flattened out of its fulfillments —
- * a return or exchange is against a shipped unit, not a line item.
+ * Every unit on the order, flattened out of its fulfillments. A return or
+ * exchange is against a fulfillment item rather than a line item, but it does
+ * not require the goods to have shipped — the backend only asks that the
+ * order is complete and not canceled, and a merchant may well open a return
+ * on something still in the warehouse.
*/
export function fulfilledUnits(order: Order): FulfilledUnit[] {
return (order.fulfillments ?? []).flatMap((fulfillment) =>
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index db56027012..8b683ce497 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -1375,26 +1375,33 @@
"add_fee": "إضافة رسوم",
"add_fee_description": "ينشئ رسومًا مثل رسوم إضافية أو مناولة أو تغليف هدايا.",
"amount_field": "المبلغ",
+ "column_amount": "المبلغ",
+ "column_code": "الرمز",
+ "column_kind": "النوع",
+ "column_label": "الوصف",
+ "column_source": "المصدر",
"delete_discount_message": "إزالة الخصم \"{{label}}\" من هذا الطلب؟ سيُعاد حساب الإجماليات.",
"delete_discount_title": "حذف الخصم",
"delete_fee_message": "إزالة الرسوم \"{{label}}\" من هذا الطلب؟ سيُعاد حساب الإجماليات.",
"delete_fee_title": "حذف الرسوم",
"discounts": "الخصومات",
- "empty": "لا توجد ضرائب أو خصومات أو رسوم على هذا الطلب بعد.",
+ "discounts_empty": "لا توجد خصومات على هذا الطلب بعد.",
"fee_kind_cod": "الدفع عند الاستلام",
"fee_kind_gift_wrap": "تغليف الهدايا",
"fee_kind_handling": "رسوم المناولة",
"fee_kind_payment": "رسوم الدفع",
"fee_kind_surcharge": "رسوم إضافية",
"fees": "الرسوم",
+ "fees_empty": "لا توجد رسوم على هذا الطلب بعد.",
"kind_field": "الفئة",
+ "kind_manual": "يدوي",
"kind_promotion": "عرض ترويجي",
"label_field": "التسمية",
"percent_preview": "الخصم المقدر: {{amount}}",
"target_field": "ينطبق على",
"target_order": "الطلب بأكمله",
"taxes": "الضرائب",
- "title": "الضرائب والخصومات والرسوم",
+ "taxes_empty": "لا توجد ضرائب على هذا الطلب بعد.",
"value_field": "القيمة",
"value_type_field": "النوع",
"value_type_flat": "مبلغ",
@@ -1773,9 +1780,9 @@
"store_credit": "رصيد المتجر"
},
"empty": "لا توجد مرتجعات لهذا الطلب.",
- "empty_nothing_fulfilled": "لم يتم شحن أي شيء في هذا الطلب بعد.",
"memo": "ملاحظة",
- "create_title": "مرتجع جديد"
+ "create_title": "مرتجع جديد",
+ "empty_no_units": "لا توجد سجلات تنفيذ في هذا الطلب يمكن الرجوع إليها."
},
"section_billing_address": "عنوان إرسال الفواتير",
"section_claims": "المطالبات",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 378d4c257c..ab354e2046 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -1375,26 +1375,33 @@
"add_fee": "Gebühr hinzufügen",
"add_fee_description": "Erstellt eine Gebühr wie Zuschlag, Bearbeitung oder Geschenkverpackung.",
"amount_field": "Betrag",
+ "column_amount": "Betrag",
+ "column_code": "Code",
+ "column_kind": "Art",
+ "column_label": "Beschreibung",
+ "column_source": "Quelle",
"delete_discount_message": "Rabatt \"{{label}}\" aus dieser Bestellung entfernen? Die Summen werden neu berechnet.",
"delete_discount_title": "Rabatt löschen",
"delete_fee_message": "Gebühr \"{{label}}\" aus dieser Bestellung entfernen? Die Summen werden neu berechnet.",
"delete_fee_title": "Gebühr löschen",
"discounts": "Rabatte",
- "empty": "Noch keine Steuern, Rabatte oder Gebühren für diese Bestellung.",
+ "discounts_empty": "Noch keine Rabatte für diese Bestellung.",
"fee_kind_cod": "Nachnahme",
"fee_kind_gift_wrap": "Geschenkverpackung",
"fee_kind_handling": "Bearbeitung",
"fee_kind_payment": "Zahlungsgebühr",
"fee_kind_surcharge": "Zuschlag",
"fees": "Gebühren",
+ "fees_empty": "Noch keine Gebühren für diese Bestellung.",
"kind_field": "Art",
+ "kind_manual": "Manuell",
"kind_promotion": "Aktion",
"label_field": "Bezeichnung",
"percent_preview": "Voraussichtlicher Rabatt: {{amount}}",
"target_field": "Gilt für",
"target_order": "Gesamte Bestellung",
"taxes": "Steuern",
- "title": "Steuern, Rabatte & Gebühren",
+ "taxes_empty": "Noch keine Steuern für diese Bestellung.",
"value_field": "Wert",
"value_type_field": "Typ",
"value_type_flat": "Betrag",
@@ -1773,9 +1780,9 @@
"store_credit": "Guthaben"
},
"empty": "Keine Retouren für diese Bestellung.",
- "empty_nothing_fulfilled": "Für diese Bestellung wurde noch nichts versandt.",
"memo": "Notiz",
- "create_title": "Neue Retoure"
+ "create_title": "Neue Retoure",
+ "empty_no_units": "Für diese Bestellung gibt es keine Fulfillment-Einträge, auf die sich eine Retoure beziehen könnte."
},
"section_billing_address": "Rechnungsadresse",
"section_claims": "Reklamationen",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index aa8fbe7c4e..272985d27a 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -1375,26 +1375,33 @@
"add_fee": "Add fee",
"add_fee_description": "Creates a fee such as a surcharge, handling or gift wrap charge.",
"amount_field": "Amount",
+ "column_amount": "Amount",
+ "column_code": "Code",
+ "column_kind": "Kind",
+ "column_label": "Description",
+ "column_source": "Source",
"delete_discount_message": "Remove the discount \"{{label}}\" from this order? Totals will be recalculated.",
"delete_discount_title": "Delete discount",
"delete_fee_message": "Remove the fee \"{{label}}\" from this order? Totals will be recalculated.",
"delete_fee_title": "Delete fee",
"discounts": "Discounts",
- "empty": "No taxes, discounts or fees on this order yet.",
+ "discounts_empty": "No discounts on this order yet.",
"fee_kind_cod": "Cash on delivery",
"fee_kind_gift_wrap": "Gift wrap",
"fee_kind_handling": "Handling",
"fee_kind_payment": "Payment fee",
"fee_kind_surcharge": "Surcharge",
"fees": "Fees",
+ "fees_empty": "No fees on this order yet.",
"kind_field": "Kind",
+ "kind_manual": "Manual",
"kind_promotion": "Promotion",
"label_field": "Label",
"percent_preview": "Estimated discount: {{amount}}",
"target_field": "Applies to",
"target_order": "Whole order",
"taxes": "Taxes",
- "title": "Taxes, discounts & fees",
+ "taxes_empty": "No taxes on this order yet.",
"value_field": "Value",
"value_type_field": "Type",
"value_type_flat": "Amount",
@@ -1773,9 +1780,9 @@
"store_credit": "Store credit"
},
"empty": "No returns for this order.",
- "empty_nothing_fulfilled": "Nothing has shipped on this order yet.",
"memo": "Note",
- "create_title": "New return"
+ "create_title": "New return",
+ "empty_no_units": "This order has no fulfillment records to return against."
},
"section_billing_address": "Billing address",
"section_claims": "Claims",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 5cd92b3ab8..5f26c6448a 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -1375,26 +1375,33 @@
"add_fee": "Ajouter des frais",
"add_fee_description": "Crée des frais tels que supplément, manutention ou emballage cadeau.",
"amount_field": "Montant",
+ "column_amount": "Montant",
+ "column_code": "Code",
+ "column_kind": "Type",
+ "column_label": "Description",
+ "column_source": "Source",
"delete_discount_message": "Retirer la remise « {{label}} » de cette commande ? Les totaux seront recalculés.",
"delete_discount_title": "Supprimer la remise",
"delete_fee_message": "Retirer les frais « {{label}} » de cette commande ? Les totaux seront recalculés.",
"delete_fee_title": "Supprimer les frais",
"discounts": "Remises",
- "empty": "Aucune taxe, remise ou frais sur cette commande pour le moment.",
+ "discounts_empty": "Aucune remise sur cette commande pour le moment.",
"fee_kind_cod": "Paiement à la livraison",
"fee_kind_gift_wrap": "Emballage cadeau",
"fee_kind_handling": "Manutention",
"fee_kind_payment": "Frais de paiement",
"fee_kind_surcharge": "Supplément",
"fees": "Frais",
+ "fees_empty": "Aucun frais sur cette commande pour le moment.",
"kind_field": "Nature",
+ "kind_manual": "Manuelle",
"kind_promotion": "Promotion",
"label_field": "Libellé",
"percent_preview": "Remise estimée : {{amount}}",
"target_field": "S'applique à",
"target_order": "Commande entière",
"taxes": "Taxes",
- "title": "Taxes, remises et frais",
+ "taxes_empty": "Aucune taxe sur cette commande pour le moment.",
"value_field": "Valeur",
"value_type_field": "Type",
"value_type_flat": "Montant",
@@ -1773,9 +1780,9 @@
"store_credit": "Avoir"
},
"empty": "Aucun retour pour cette commande.",
- "empty_nothing_fulfilled": "Rien n’a encore été expédié pour cette commande.",
"memo": "Note",
- "create_title": "Nouveau retour"
+ "create_title": "Nouveau retour",
+ "empty_no_units": "Cette commande n’a aucun enregistrement de traitement sur lequel baser un retour."
},
"section_billing_address": "Adresse de facturation",
"section_claims": "Réclamations",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 22220e8bf2..14cb99e885 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -1381,26 +1381,33 @@
"add_fee": "Dodaj opłatę",
"add_fee_description": "Tworzy opłatę, np. dopłatę, koszt obsługi lub pakowanie na prezent.",
"amount_field": "Kwota",
+ "column_amount": "Kwota",
+ "column_code": "Kod",
+ "column_kind": "Rodzaj",
+ "column_label": "Opis",
+ "column_source": "Źródło",
"delete_discount_message": "Usunąć rabat „{{label}}” z tego zamówienia? Sumy zostaną przeliczone.",
"delete_discount_title": "Usuń rabat",
"delete_fee_message": "Usunąć opłatę „{{label}}” z tego zamówienia? Sumy zostaną przeliczone.",
"delete_fee_title": "Usuń opłatę",
"discounts": "Rabaty",
- "empty": "Brak podatków, rabatów lub opłat dla tego zamówienia.",
+ "discounts_empty": "Brak rabatów dla tego zamówienia.",
"fee_kind_cod": "Płatność przy odbiorze",
"fee_kind_gift_wrap": "Pakowanie na prezent",
"fee_kind_handling": "Koszt obsługi",
"fee_kind_payment": "Opłata za płatność",
"fee_kind_surcharge": "Dopłata",
"fees": "Opłaty",
+ "fees_empty": "Brak opłat dla tego zamówienia.",
"kind_field": "Rodzaj",
+ "kind_manual": "Ręczne",
"kind_promotion": "Promocja",
"label_field": "Etykieta",
"percent_preview": "Szacowany rabat: {{amount}}",
"target_field": "Dotyczy",
"target_order": "Całe zamówienie",
"taxes": "Podatki",
- "title": "Podatki, rabaty i opłaty",
+ "taxes_empty": "Brak podatków dla tego zamówienia.",
"value_field": "Wartość",
"value_type_field": "Typ",
"value_type_flat": "Kwota",
@@ -1781,9 +1788,9 @@
"store_credit": "Kredyt sklepowy"
},
"empty": "Brak zwrotów dla tego zamówienia.",
- "empty_nothing_fulfilled": "Nic jeszcze nie zostało wysłane w tym zamówieniu.",
"memo": "Notatka",
- "create_title": "Nowy zwrot"
+ "create_title": "Nowy zwrot",
+ "empty_no_units": "To zamówienie nie ma pozycji realizacji, do których można odnieść zwrot."
},
"section_billing_address": "Adres rozliczeniowy",
"section_claims": "Reklamacje",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index f5dc9e2052..846ed201ca 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -1375,26 +1375,33 @@
"add_fee": "添加费用",
"add_fee_description": "创建附加费、手续费或礼品包装等费用。",
"amount_field": "金额",
+ "column_amount": "金额",
+ "column_code": "代码",
+ "column_kind": "类型",
+ "column_label": "说明",
+ "column_source": "来源",
"delete_discount_message": "从该订单中移除折扣“{{label}}”?总计将重新计算。",
"delete_discount_title": "删除折扣",
"delete_fee_message": "从该订单中移除费用“{{label}}”?总计将重新计算。",
"delete_fee_title": "删除费用",
"discounts": "折扣",
- "empty": "该订单暂无税费、折扣或费用。",
+ "discounts_empty": "该订单暂无折扣。",
"fee_kind_cod": "货到付款",
"fee_kind_gift_wrap": "礼品包装",
"fee_kind_handling": "手续费",
"fee_kind_payment": "支付手续费",
"fee_kind_surcharge": "附加费",
"fees": "费用",
+ "fees_empty": "该订单暂无费用。",
"kind_field": "种类",
+ "kind_manual": "手动",
"kind_promotion": "促销",
"label_field": "名称",
"percent_preview": "预计折扣:{{amount}}",
"target_field": "适用于",
"target_order": "整个订单",
"taxes": "税费",
- "title": "税费、折扣与费用",
+ "taxes_empty": "该订单暂无税费。",
"value_field": "数值",
"value_type_field": "类型",
"value_type_flat": "金额",
@@ -1773,9 +1780,9 @@
"store_credit": "商店积分"
},
"empty": "此订单暂无退货。",
- "empty_nothing_fulfilled": "此订单尚未发货。",
"memo": "备注",
- "create_title": "新建退货"
+ "create_title": "新建退货",
+ "empty_no_units": "此订单没有可用于退货的履约记录。"
},
"section_billing_address": "账单地址",
"section_claims": "索赔",