553f4c52fed4e5eb52868e1b59b3bcbfa1d78f4c
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1332ad7bc5 |
feat(erpsetup): catalogue for Leistungsbeschreibung 1.0.0, opt-in -sync-catalog (#115)
Brings the ERPNext sales catalogue in line with the frozen Leistungsbeschreibungen 1.0.0. This PR changes code and tests only. No ERP was called; the live run is yours, using the erpsetup CLI. ## Dry run first (with the flag; only this path prints `field old → new`) ```sh ERP_BASE_URL=https://erp.breakpilot.com ERP_API_KEY=… ERP_API_SECRET=… ERP_WEBHOOK_SECRET=… \ go run ./cmd/erpsetup -webhook-url https://registry.breakpilot.com/v1/internal/erp/webhook -sync-catalog -dry-run ``` (`ERP_LEAD_DOCTYPE` is optional, as before.) Leave out `-dry-run` for the real run. ## What a run does with and without `-sync-catalog` | | without the flag (as today) | with `-sync-catalog` | |---|---|---| | New items, unit "Prüftag", their list prices | created | created | | Item **description** | **updated (this already happens on every run today)** | updated | | Item `item_name`, `disabled` | untouched | updated when they differ | | Standard Selling `price_list_rate` (rows without a customer) | set once, never changed | updated when it differs | | Customer-specific Item Prices | untouched | untouched | | Quote print format (Mehrverbrauch row) | updated | updated | **A plain run is not inert.** It creates the 5 new items, the new unit and 5 new prices, rewrites every changed description, and updates the quote template. Only names, the disabled flags and price changes wait for the flag. Nothing is ever deleted. Only the doctypes Item, Item Price and UOM are touched beyond what erpsetup already manages. ## Catalogue changes | Code | Status | Price old → new (EUR) | |---|---|---| | PLT-CORE-CLD-STD/BUS/ENT | keep (name "Breakpilot …", new text) | 290 / 790 / 1990 (unchanged) | | PLT-BNDL-CLD-STD | **new** Starter-Modulpaket | 990 | | PLT-BNDL-CLD-ADD | **new** Weiteres Modul | 499 | | CRA-CSA-CLD-STD | keep | **1490 → 490** | | CRA-CSA-CLD-BUS | keep | **3990 → 1290** | | CRA-CSA-CLD-ENT | keep | **9900 → 0** (Preis nach Vereinbarung: a quote shows 0,00 € unless the rate is entered by hand) | | CRA-CSA-CLD-TGT | **new** extra Prüfobjekt / Monat | 5.99 | | CRA-CSA-CLD-DAY | **new** Prüftag (unit Prüftag) | 9.99 | | CRA-CSA-CLD-SCAN | **disable** | 12 (unchanged) | | CRA-WBK-CLD-STD/BUS/ENT | **disable** | unchanged | | DEV-WP-CLD-STD | keep ("Werkpilot Cloud") | 59 | | DEV-WP-CLD-BUS/ENT | **disable** | unchanged | | DEV-WP-OPR-*, DEV-FWK-OPR-*, INF-GIT-OPR-*, INF-CI-OPR-* | keep, new texts | unchanged | | DEV-FWK-CLD-STD | keep ("Firmwerk Cloud") | 89 | | DEV-FWK-CLD-BUS/ENT | **disable** | unchanged | | INF-GIT-CLD-STD/BUS/ENT | keep, new texts | 190 / 390 / 790 | | INF-GIT-CLD-USR | **new** extra user | 19 | | INF-CI-CLD-STD/BUS/ENT | keep, new texts | 149 / 290 / 590 | The item group stays "BreakPilot Abonnements". Correction to the spec, applied here: PLT-CORE-CLD-STD no longer mentions "Rechnungen", because LB Plattform §2(3) says the portal provides no invoices. The text is now "Arbeitsbereich mit Anmeldung und Team für bis 25 Nutzer, Standard-Support. Module werden einzeln gebucht." No other item text mentions invoices, and a test now checks that none does. ## Other changes - `sku.Disabled` is sent to ERPNext as the Item field `disabled: 1`. Disabled items stay in ERPNext so old documents keep working. Since the disabled items already exist on prod, their flag only changes with `-sync-catalog`. - **Quote, Mehrverbrauch row:** "Zusätzliche Prüfobjekte werden mit {TGT} netto je Monat berechnet, Prüftage nach verbrauchtem Monatskontingent mit {DAY} netto (Leistungsbeschreibung Prüfwerk, Abschnitt 7)." If a rate is missing, the text says "gemäß der jeweils gültigen Preisliste" instead, per rate. If both are missing, one combined sentence is printed. Quotes with INF-GIT-CLD-STD/BUS/ENT or PLT-BNDL-* add the sentence on extra users (Leistungsbeschreibung Breakpilot Plattform, Abschnitt 4). The Jinja was parsed and rendered locally with jinja2 against mocks for eight item mixes. - **Migration 0026** adds CRA-CSA-CLD-TGT and -DAY to the `pruefwerk` product. SCAN stays so old orders still map. The up is guarded so it can run twice; the down removes the two SKUs. `DefaultProducts` and the ERP mock's SKU list follow. **Run `migrate-up` with the deploy.** Without it, TGT/DAY lines on an order log "sales order item without catalog product". - **0 € module lines:** nothing needed fixing. Neither the webhook path nor reconcile reads the rate: the webhook template sends only `item_code` and `qty`, and `SubscriptionPlan` has no rate. A new test covers both paths: a bundle order with modules at rate 0 and qty 15 gives an active tenant, plan standard, and seats 15 per module. ## Decisions the spec did not cover 1. **No Prüfwerk Mehrverbrauch sentence on Enterprise quotes.** CRA-CSA-CLD-ENT is "ohne Begrenzung". Edge case: a quote with both -STD and -ENT also prints no Prüfwerk sentence. The extra-users sentence is not affected. 2. The run without the flag still writes descriptions, as `Run` has done until now (see the table). 3. `-sync-catalog` only changes Item Price rows without a `customer`. If there are several such rows for an item, the run reports "not synced". If there are none, it creates the list price. 4. The quote template's Item Price lookup still has no customer filter (unchanged from before). 5. INF-GIT-OPR texts: STD uses the spec text exactly, so "kein Quellcode verlässt das Haus" is gone. BUS keeps "für mittelgroße Teams" and loses "schnellerer Patch-Rhythmus", like CI. ENT says "für große Entwicklungsorganisationen". 6. INF-CI-OPR texts differ only by size ("mindestens 2 vCPU / 4 GB" etc.); "für größere/umfangreiche Builds" was dropped. 7. DEV-WP-OPR and DEV-FWK-OPR texts: the tier phrase sits after "im eigenen Netz", e.g. "Werkpilot im eigenen Netz für mittlere Teams, mit einem vom Kunden betriebenen KI-Modell; …". 8. TGT/DAY quantities on an order or subscription count toward Prüfwerk `seats`, exactly as SCAN already does. Not changed here. 9. Bundle revenue goes to cost center Plattform (PLT-*). Module lines at 0 € book nothing on Prüfwerk, Firmwerk or Werkpilot. Whether to allocate it is an accounting decision for you. 10. The dry run prints texts in full (no truncation), so the wording can be read before it goes live. 11. `TestEverySKUHasAListPrice` now allows exactly one item at 0: CRA-CSA-CLD-ENT. 12. The ERP mock's `DefaultSKUs` now also lists PLT-BNDL-* and CRA-CSA-CLD-TGT/DAY. ## Tests `go build ./... && go vet ./... && go test ./...` all pass. The Postgres testcontainers suites ran (podman socket) with no skips: server 463 s, migrations 32 s. New tests: - catalogue consistency: unique codes, units, disabled set, prices including 5.99/9.99, brand spelling - `TestSyncCatalog`: the dry run writes nothing and names every change; the run updates name, description, disabled and price and keeps the customer price; a second run makes no updates; without the flag only the description changes - quote template phrases - `TestMigrate_productsSeedMatchesDefaults`: seed equals `DefaultProducts`, 0026 applied twice, down - `TestErp_zeroRateModuleLinesEntitle`: webhook and reconcile, memory and Postgres 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Reviewed-on: #115 |
||
|
|
40a198c56f |
feat(erpsetup): BreakPilot document layout and list prices (#51)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB |
||
|
|
8a03be188d |
feat(erpsetup): sales catalogue — SKU items, units, SEPA mandate fields (#48)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB |
||
|
|
ceeff16f26 | feat(erp): erpsetup for live ERPNext, reserved tenant slugs (#32) |