Simplify: O2M batch, domain dedup, db.go split, constants

Performance:
- O2M formatO2MFields: N+1 → single batched query per O2M field
  (collect parent IDs, WHERE inverse IN (...), group by parent)

Code dedup:
- domain.go compileSimpleCondition: 80 lines → 12 lines by delegating
  to compileQualifiedCondition (eliminates duplicate operator handling)
- db.go SeedWithSetup: 170-line monolith → 5 focused sub-functions
  (seedCurrencyAndCountry, seedCompanyAndAdmin, seedJournalsAndSequences,
  seedChartOfAccounts, resetSequences)

Quality:
- Magic numbers (80, 200, 8) replaced with named constants
- Net -34 lines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc
2026-04-03 13:11:37 +02:00
parent 70320b6b29
commit 6fd9cdea1b
4 changed files with 132 additions and 166 deletions

View File

@@ -575,7 +575,7 @@ func (s *Server) dispatchORM(env *orm.Environment, params CallKWParams) (interfa
}
}
limit := 8
limit := defaultNameSearchLimit
if v, ok := params.KW["limit"].(float64); ok {
limit = int(v)
}