Skip to content

OSSS.db.migrations.versions.raw_data.generate_gl_account_segments_csv

OSSS.db.migrations.versions.raw_data.generate_gl_account_segments_csv

write_gl_accounts(rows, output)

Export GL accounts aligned with GLAccount model.

write_gl_segments(output)

Export GLSegment dimension table.

write_gl_account_segments(rows, output)

Per-account segment breakdown suitable for seeding gl_account_segments.

write_gl_segment_values(rows, output)

Create GLSegmentValue rows:

id, code, name, active, segment_id

Ensures name is never empty by falling back to " " or "".

generate_fiscal_year_rows(start_year=2025, num_years=1)

Generate FiscalYear rows aligned with the FiscalYear model:

id, year, start_date, end_date, is_closed

Currently generates simple calendar years (Jan 1 - Dec 31).

write_fiscal_years(output)

Write fiscal_years.csv and return the generated year rows.

generate_fiscal_period_rows(fiscal_year_row, num_periods=12)

Generate fiscal period rows aligned with FiscalPeriod model:

id, year_number, period_no, start_date, end_date, is_closed

Uses FiscalYear.year as year_number (FK to fiscal_years.year).

write_fiscal_periods(output, fiscal_year_row)

Write fiscal_periods.csv based on a given fiscal year and return periods.

write_gl_account_balances(rows, fiscal_periods, output)

Creates dummy account balances:

id, account_id, fiscal_period_id, begin_balance, debit_total, credit_total, end_balance, attributes

Uses a real fiscal_period_id from the generated fiscal_periods.