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_skuon gift-set shells. - Not in this patch: clearing shell sell after orphan fill (Σ line sell can still exceed invoice); Analysis prefers component SKUs.
✅ Verify¶
- Classic unlinked bundle (shell
[BUNDLE]@ paid +[-]components @ 0) → components getprice_gross/ fee / profit after import. - Analysis stock-consumer overview for the main SKU → no phantom −EK from unresolved zero lines.
- 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. - Line that already has
brutto_buy_price→ backfill leaves it unchanged. - Tests:
pytest backend/service_omni/app/tests/test_plenty_order_enrichment.pypytest backend/service_omni/app/tests/test_amazon_order_enrichment.pypytest 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 backfillbackend/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 6backend/service_omni/app/tests/test_plenty_order_enrichment.pybackend/service_omni/app/tests/test_amazon_order_enrichment.pybackend/service_multi-repricer/app/services/article_stats.py— Analysis zero-sell skipbackend/service_multi-repricer/app/tests/test_article_stats.pydocs/docs/services/service_omni/services/profit_imports_and_analysis.mddocs/docs/patchnotes/1.11/1.11.11.md— this file