Skip to content

1.11.11

⚙️ Patch 1.11.11 — Plenty orphan bundles, Analysis zero-sell guard, EK backfill cron

🚀 Summary

Fixes fake Analysis losses (e.g. −1111.99 € on Rituals gift-set components) when Plenty ships a paid [BUNDLE] shell plus zero-price [-] parts without BOM links. Daily Profit cron now backfills null buy prices from repricer_articles (Plenty + Amazon) and recomputes fee/profit — never overwrites an EK that is already set.

✨ Details

Area Behavior
Orphan bundle fill One (or N identical [BUNDLE]) paid shell(s) + unlinked zero components → split sell by EK weights (qty fallback); multi-shell pairs greedily (one of each zero SKU per shell)
Shell clear safety Orphan fill only touches lines that were zero before allocate (originally_zero_idxs) — does not re-price shells cleared by clear_shell_sell
Ambiguous orders Non-[BUNDLE] multi-priced + zeros → skip allocate, log warning
Analysis guard Skip sales lines with unit_sell ≤ 0 and profit is None (no invented −EK); zero-sell retours use unit_profit=0 but keep refund_expenses
Plenty EK backfill Cron step: null brutto_buy_price in last 30 days → fill from repricer_articles → missing fee/profit → refresh total_order_*
Amazon EK backfill Same window: null buy via fba_details → repricer EK → fee/profit (only_fill_missing_buy)
Logging Per fill: backfill_plenty_buy: filled order=… sku=… / backfill_amazon_buy: filled order=… asin=…; summary with rows_filled / skus / asins

📌 Notes

  • Redeploy service-omni and service-multi-repricer.
  • After deploy, Profit cron picks up backfill automatically; optional: re-import Plenty orders for a date range to refresh orphan allocates.
  • Catalog hygiene still helps accuracy: component EKs (e.g. sticks) and bundle_packages / parent_sku on gift-set shells.
  • Not in this patch: clearing shell sell after orphan fill (Σ line sell can still exceed invoice); Analysis prefers component SKUs.

✅ Verify

  1. Classic unlinked bundle (shell [BUNDLE] @ paid + [-] components @ 0) → components get price_gross / fee / profit after import.
  2. Analysis stock-consumer overview for the main SKU → no phantom −EK from unresolved zero lines.
  3. Set EK on a SKU that had null-buy order lines → next cron (or manual backfill_missing_buy_prices) fills buy + profit; logs show order/SKU.
  4. Line that already has brutto_buy_price → backfill leaves it unchanged.
  5. Tests:
  6. pytest backend/service_omni/app/tests/test_plenty_order_enrichment.py
  7. pytest backend/service_omni/app/tests/test_amazon_order_enrichment.py
  8. pytest backend/service_multi-repricer/app/tests/test_article_stats.py (zero-sell skip)

📁 Files

  • backend/service_omni/app/services/plenty/order_enrichment.py — orphan allocate + Plenty buy backfill
  • backend/service_omni/app/services/amazon/order_enrichment.py — Amazon buy backfill (only_fill_missing_buy)
  • backend/service_omni/app/api/v1/endpoints/statistics.py — cron step 6
  • backend/service_omni/app/tests/test_plenty_order_enrichment.py
  • backend/service_omni/app/tests/test_amazon_order_enrichment.py
  • backend/service_multi-repricer/app/services/article_stats.py — Analysis zero-sell skip
  • backend/service_multi-repricer/app/tests/test_article_stats.py
  • docs/docs/services/service_omni/services/profit_imports_and_analysis.md
  • docs/docs/patchnotes/1.11/1.11.11.md — this file