Commit Graph
15 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 c0a7db4e56 fix(erpsetup): restore the letter head source, ignore <tbody> from UI saves
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 25m56s
ci / image (pull_request) Skipped
The live letter head had source "Image" (saved in the UI on 2026-10-06), so
documents printed an image header instead of the HTML one. erpsetup compared
only content and footer and would never have put it back; it now also
compares source and footer_source.

The same UI save wrapped the table rows in <tbody>, which made content and
footer look changed on every run. Field comparison now ignores <tbody>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-10-13 11:07:50 +02:00
sharangandSharang Parnerkar 8e2d8db4bf feat(erpsetup): cost centers per product, deferred revenue for yearly items (#67)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 25m45s
ci / image (push) Successful in 37s
## What
erpsetup gets two accounting steps (new `internal/erpsetup/accounting.go`), run after the contract-basis fields:

**A1: cost centers**
- Creates Plattform, Prüfwerk, Firmwerk, Werkpilot, Infrastruktur and Verwaltung below the company's root cost center.
- Makes **Verwaltung** the company default. `Main` is kept, not renamed.
- Gives every SKU its product's **selling cost center** in its Item Defaults row for the company:
  - PLT → Plattform
  - CRA (Prüfwerk + Werkbank) → Prüfwerk
  - DEV-FWK → Firmwerk
  - DEV-WP → Werkpilot
  - INF (Managed Git + build runners) → Infrastruktur
- Other Item Defaults rows and other fields of the company's row (e.g. an income account) are kept.

**A2: deferred revenue**
- The 12 yearly items (`Jahr`: Werkpilot, Firmwerk, Managed Git and build-runner On-Prem) get `enable_deferred_revenue` over **12 months**.
- The company's default deferred revenue account becomes **SKR04 3900** (looked up by account number, never created). If it's missing, the deferral steps are skipped and reported as `missing (not created)`.
- Accounts Settings release the deferral **monthly as Journal Entries that stay drafts** (`submit_journal_entries = 0`): a person checks and submits them.

## Why
These follow the decisions with the tax advisor on 2026-10-12 (Collectives ERP/07):
- Cost centers live in ERPNext only, with no KOST1 in DATEV. They give a P&L per product.
- Yearly licences are deferred, so the monthly ERPNext P&L can be compared with her BWA. She books the RAP at year end in DATEV.

## How
- The cost-center and account names carry the company abbreviation, which is read from the Company.
- Item Defaults are PUT as the full table, because rows left out would be deleted.
- Idempotent and dry-run capable like the other steps; nothing is submitted.

## Test plan
- [x] Unit tests (fake Frappe):
  - cost centers and their parent
  - company defaults
  - Accounts Settings
  - cost center per SKU, deferral only on yearly items
  - existing Item Defaults rows and fields are kept
  - a missing 3900 skips the deferral
  - a missing company stops the run
- [x] Second run is a no-op; the dry run writes nothing.
- [ ] `erpsetup -dry-run` against live ERPNext (user): check that `deferred revenue account 3900` resolves, and expect 6 cost centers, 2 company fields, the Accounts Settings and 34 items as `would create`/`would update`.
- [ ] Apply, then spot-check one Werkpilot On-Prem item and one Prüfwerk item in ERPNext.

## Risk
**Blast radius:** live ERPNext master data: cost centers, company defaults, Accounts Settings, Item Defaults and deferral flags on the 34 SKU items. No transactions are touched.

**What could break:**
- New Sales Invoices for yearly items now need a service start and end date (ERPNext fills them from the posting date and the 12 months). Monthly items are unchanged.
- A Journal Entry draft appears each month for open deferrals.

**Rollback plan:** in ERPNext:
- set the company default cost center back to Main
- untick deferred revenue on the 12 yearly items
Cost centers can stay. Nothing is submitted by this change.

## Checklist
- [x] Docs updated (package doc; Collectives ERP/06 gets the cost-center note after the apply)
- [x] Audit events emitted for state changes (n/a: ERP master data)
- [x] Secrets via Infisical, never in repo (no secrets)
- [x] Migration is forward-only + idempotent (no migration; erpsetup is idempotent)
- [x] Tenant scoping enforced on every DB query (no DB access)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #67
2026-10-13 09:02:58 +00:00
sharang 8753305ad4 feat(services): build runners INF-CI-* and managed service kind ci-runner (#62)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 24m26s
ci / image (push) Successful in 36s
2026-10-05 18:06:49 +00:00
sharangandClaude Opus 5.5 5668895055 feat(erpsetup): Managed Git items INF-GIT-CLD/OPR-STD/BUS/ENT (#60)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 24m12s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-10-04 19:07:36 +00:00
sharangandClaude Opus 5.5 6141e45811 feat(erpsetup): AB and invoice after the legal review (#59)
ci / test (push) Successful in 24m9s
ci / shared (push) Successful in 12s
ci / image (push) Successful in 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 16:26:47 +00:00
sharangandClaude Opus 5.5 5f7a383ea8 fix(erpsetup): letter head shows only contact details top right (#56)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m51s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 14:47:43 +00:00
sharangandClaude Opus 5.5 7e75fbafb3 fix(erpsetup): logo as a private File, PDFs work again (#55)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 23m44s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 13:32:48 +00:00
sharangandClaude Opus 5.5 2c365b9b3d fix(erpsetup): domestic customer address without capitals and country (#54)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m41s
ci / image (push) Successful in 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 12:20:07 +00:00
sharangandClaude Opus 5.5 fb241befcc fix(erpsetup): letter head and footer in the print template, chevron as PNG (#53)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m53s
ci / image (push) Successful in 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 11:48:16 +00:00
sharangandClaude Opus 5.5 40a198c56f feat(erpsetup): BreakPilot document layout and list prices (#51)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m50s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 10:44:03 +00:00
sharangandClaude Opus 5.5 c33ae65342 fix(erp): webhook templates and usage datetimes for the live ERPNext (#49)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m40s
ci / image (push) Successful in 49s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 08:43:17 +00:00
sharangandClaude Opus 5.5 8a03be188d feat(erpsetup): sales catalogue — SKU items, units, SEPA mandate fields (#48)
ci / image (push) Successful in 34s
ci / shared (push) Successful in 14s
ci / test (push) Successful in 23m42s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-29 16:25:00 +00:00
sharangandClaude Opus 5.5 fb8a6b3902 fix(erpsetup): name the Frappe webhooks (#38)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m20s
ci / image (push) Successful in 33s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-24 10:34:09 +00:00
sharangandClaude Opus 5.5 25419c48b3 fix(erpsetup): let the registry's API user append usage records (#36)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 23m25s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-23 21:36:36 +00:00
sharang ceeff16f26 feat(erp): erpsetup for live ERPNext, reserved tenant slugs (#32)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 22m58s
ci / image (push) Successful in 37s
2026-09-23 17:16:24 +00:00