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
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
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
Docs updated (package doc; Collectives ERP/06 gets the cost-center note after the apply)
Audit events emitted for state changes (n/a: ERP master data)
Secrets via Infisical, never in repo (no secrets)
Migration is forward-only + idempotent (no migration; erpsetup is idempotent)
Tenant scoping enforced on every DB query (no DB access)
## 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
Decided with the tax advisor on 2026-10-12 (Collectives ERP/07): cost centers
stay in ERPNext (no KOST1 in DATEV), and yearly licences are deferred so the
monthly P&L shows a twelfth per month.
- Cost centers Plattform, Prüfwerk, Firmwerk, Werkpilot, Infrastruktur and
Verwaltung below the company's root; Verwaltung becomes the company default
(Main is kept, not renamed).
- Every SKU gets its product's selling cost center in its Item Defaults row
for the company (PLT → Plattform, CRA → Prüfwerk, DEV-FWK → Firmwerk,
DEV-WP → Werkpilot, INF → Infrastruktur). Other rows and fields are kept.
- Yearly items ("Jahr") get deferred revenue over 12 months; the company's
default deferred revenue account is SKR04 3900. Accounts Settings release
it monthly as Journal Entries that stay drafts (submit_journal_entries=0).
- Without account 3900 the deferral steps are skipped and reported; the
account is never created here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang
merged commit 8e2d8db4bf into main2026-10-13 09:03:00 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
erpsetup gets two accounting steps (new
internal/erpsetup/accounting.go), run after the contract-basis fields:A1: cost centers
Mainis kept, not renamed.A2: deferred revenue
Jahr: Werkpilot, Firmwerk, Managed Git and build-runner On-Prem) getenable_deferred_revenueover 12 months.missing (not created).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):
How
Test plan
erpsetup -dry-runagainst live ERPNext (user): check thatdeferred revenue account 3900resolves, and expect 6 cost centers, 2 company fields, the Accounts Settings and 34 items aswould create/would update.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:
Rollback plan: in ERPNext:
Cost centers can stay. Nothing is submitted by this change.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Decided with the tax advisor on 2026-10-12 (Collectives ERP/07): cost centers stay in ERPNext (no KOST1 in DATEV), and yearly licences are deferred so the monthly P&L shows a twelfth per month. - Cost centers Plattform, Prüfwerk, Firmwerk, Werkpilot, Infrastruktur and Verwaltung below the company's root; Verwaltung becomes the company default (Main is kept, not renamed). - Every SKU gets its product's selling cost center in its Item Defaults row for the company (PLT → Plattform, CRA → Prüfwerk, DEV-FWK → Firmwerk, DEV-WP → Werkpilot, INF → Infrastruktur). Other rows and fields are kept. - Yearly items ("Jahr") get deferred revenue over 12 months; the company's default deferred revenue account is SKR04 3900. Accounts Settings release it monthly as Journal Entries that stay drafts (submit_journal_entries=0). - Without account 3900 the deferral steps are skipped and reported; the account is never created here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB