fix(orders): preserve order_items on mark_order_deleted_in_roa
Detail view for DELETED_IN_ROA orders showed "Niciun articol" because the soft-delete helper hard-deleted order_items. Now items stay in SQLite so the detail page displays the original GoMag order alongside "Comanda stearsa din ROA". On 'Reimporta', add_order_items already replaces them via DELETE+INSERT inside _safe_upsert_order_items. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1288,10 +1288,13 @@ async def clear_order_invoice(order_number: str):
|
||||
|
||||
|
||||
async def mark_order_deleted_in_roa(order_number: str):
|
||||
"""Mark an order as deleted in ROA — clears id_comanda, invoice cache, and stale items."""
|
||||
"""Mark an order as deleted in ROA — clears id_comanda + invoice cache.
|
||||
|
||||
order_items are preserved so the detail view can still show what was
|
||||
originally ordered. On 'Reimporta', add_order_items replaces them.
|
||||
"""
|
||||
db = await get_sqlite()
|
||||
try:
|
||||
await db.execute("DELETE FROM order_items WHERE order_number = ?", (order_number,))
|
||||
await db.execute(f"""
|
||||
UPDATE orders SET
|
||||
status = '{OrderStatus.DELETED_IN_ROA.value}',
|
||||
|
||||
Reference in New Issue
Block a user