Artikel aus Shopware importieren und mit ERPNext Items verknüpfen #13

Closed
opened 2026-05-10 16:43:48 +00:00 by csaeum · 1 comment
csaeum commented 2026-05-10 16:43:48 +00:00 (Migrated from gitlab.localdomain)

Shopware-Produkte über die Admin API abrufen und als ERPNext Items anlegen:

  • Endpoint: GET /api/product (mit Pagination)
  • Felder: Name, Artikelnummer, Beschreibung, Kategorie
  • Shopware Product ID in einem Custom Field am ERPNext Item speichern
  • Bereits vorhandene Items (gleiche Artikelnummer) nicht doppelt anlegen
  • Implementierung in shopware6/api/product.py
Shopware-Produkte über die Admin API abrufen und als ERPNext Items anlegen: - Endpoint: `GET /api/product` (mit Pagination) - Felder: Name, Artikelnummer, Beschreibung, Kategorie - Shopware Product ID in einem Custom Field am ERPNext Item speichern - Bereits vorhandene Items (gleiche Artikelnummer) nicht doppelt anlegen - Implementierung in `shopware6/api/product.py`
Owner

Implemented in ecommerce_integrations/shopware6/api/product.py (list_products() + import_products()), plus Shopware Account.import_products() (whitelisted method + new "Import Products" button), and a new shopware_product_id Custom Field on Item.

Research (Julian/Marcel): Julian only imports products one-at-a-time during order import (SDK-based, not our raw-requests pattern), takes only categories[0], and dedups via an Ecommerce Item DocType. Marcel has a real paginated bulk importer with the same POST search/product pagination shape we already use, but pulls in prices/stock/images/variants/brand/SEO — same overreach already rejected in #12. Notably Marcel's category-map builder filters on the exact same Item Group.shopware_category_id field name we picked independently in #12 — good confirmation, not attributed as copied.

Design decisions taken (informed, not ported):

  • Dedup on item_code == productNumber directly (no Ecommerce Item indirection needed).
  • Item Group resolution: first Shopware category already present as Item Group.shopware_category_id (from #12).
  • Fallback to "All Item Groups" when no category matches.

Live verification against the real catalog:

  • Confirmed POST /api/search/product needs explicit {"associations": {"categories": {}}} to return the category m:n relation; categories[i].id matches Item Group.shopware_category_id values imported in #12.
  • Full round-trip against 2279 real products: 2279 created (87 resolved to a real Item Group, 2192 fell back to "All Item Groups"), second run correctly skipped all 2279 (dedup verified).
  • No scope creep: no prices, stock, images, variants, or additional-category child rows.
  • Test data (items, item groups, test account) cleaned up after verification.

See Projekt.md → Architecture Decisions for the full writeup.

Implemented in `ecommerce_integrations/shopware6/api/product.py` (`list_products()` + `import_products()`), plus `Shopware Account.import_products()` (whitelisted method + new "Import Products" button), and a new `shopware_product_id` Custom Field on `Item`. **Research (Julian/Marcel):** Julian only imports products one-at-a-time during order import (SDK-based, not our raw-`requests` pattern), takes only `categories[0]`, and dedups via an `Ecommerce Item` DocType. Marcel has a real paginated bulk importer with the same `POST search/product` pagination shape we already use, but pulls in prices/stock/images/variants/brand/SEO — same overreach already rejected in #12. Notably Marcel's category-map builder filters on the exact same `Item Group.shopware_category_id` field name we picked independently in #12 — good confirmation, not attributed as copied. **Design decisions taken (informed, not ported):** - Dedup on `item_code == productNumber` directly (no `Ecommerce Item` indirection needed). - Item Group resolution: first Shopware category already present as `Item Group.shopware_category_id` (from #12). - Fallback to `"All Item Groups"` when no category matches. **Live verification against the real catalog:** - Confirmed `POST /api/search/product` needs explicit `{"associations": {"categories": {}}}` to return the category m:n relation; `categories[i].id` matches `Item Group.shopware_category_id` values imported in #12. - Full round-trip against 2279 real products: 2279 created (87 resolved to a real Item Group, 2192 fell back to "All Item Groups"), second run correctly skipped all 2279 (dedup verified). - No scope creep: no prices, stock, images, variants, or additional-category child rows. - Test data (items, item groups, test account) cleaned up after verification. See `Projekt.md` → Architecture Decisions for the full writeup.
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Frappe-Projekte/ecommerce_integrations#13
No description provided.