Skip to content

[18.0][IMP] date_range: add automatic "As Of Month" cumulative date range generation#1259

Open
BhaveshHeliconia wants to merge 1 commit intoOCA:18.0from
HeliconiaIO:18.0-imp-date_range
Open

[18.0][IMP] date_range: add automatic "As Of Month" cumulative date range generation#1259
BhaveshHeliconia wants to merge 1 commit intoOCA:18.0from
HeliconiaIO:18.0-imp-date_range

Conversation

@BhaveshHeliconia
Copy link
Copy Markdown

@BhaveshHeliconia BhaveshHeliconia commented Mar 20, 2026

This PR adds automatic generation of cumulative monthly "As Of Month" date ranges to the date_range module.

Changes

New "As Of Month" date range type:

  • Added a new date.range.type data record (date_range_as_of_month) with allow_overlap=True, used for cumulative monthly ranges (e.g., "As Of January 2025", "As Of February 2025", etc.).

Automatic generation via cron:

  • Added generate_next_years_as_of_month() method on date.range.type that auto-generates cumulative ranges from January 1st of the current year through each month's end, for a configurable number of years.
  • Added a monthly cron job (cron_generate_next_years_as_of_month) to trigger this generation automatically.

Settings configuration:

  • Added a new res.config.settings model (res_config_settings.py) with a cumulative_month_range_years field (default: 5) to control how many years of ranges are generated.
  • Added a settings view under General Settings → "Date Range Configuration".

Manual generation guard:

  • Added a UserError in action_apply() of the date range generator wizard to prevent manual generation for the "As Of Month" type, since it is system-managed.

Search view improvement:

  • Added a "Group by Type" filter in the date range search view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant