Skip to content

[15.0][IMP] hr_payroll_period: add a company parameter to select the months in advance for creating the new HR periods #217

Open
AaronHForgeFlow wants to merge 1 commit intoOCA:15.0from
ForgeFlow:15.0-imp-hr_perioll_period-cron-month
Open

[15.0][IMP] hr_payroll_period: add a company parameter to select the months in advance for creating the new HR periods #217
AaronHForgeFlow wants to merge 1 commit intoOCA:15.0from
ForgeFlow:15.0-imp-hr_perioll_period-cron-month

Conversation

@AaronHForgeFlow
Copy link

@AaronHForgeFlow AaronHForgeFlow commented Oct 2, 2025

Currently users cannot select how much in advance the periods are created.

image

I can put days instead of months...

@OCA-git-bot
Copy link
Contributor

Hi @nimarosa,
some modules you are maintaining are being modified, check this out!

class ResCompany(models.Model):
_inherit = "res.company"

fiscalyear_creation_months_before = fields.Integer(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improvement suggestion:

Constraint: add a validation to ensure that the fiscalyear_creation_months_before field only accepts values between 0 and 12. In practice, it doesn’t make sense to create the next payroll fiscal year more than 12 months in advance, since this may lead to inconsistent records and confusion in reports.

Rename field: consider renaming it to payroll_fiscalyear_creation_months_before, making it more explicit that this parameter is related to payroll fiscal years. This avoids ambiguity in case other modules need similar parameters in the future.

Example constraint:

@api.constrains("fiscalyear_creation_months_before")
def _check_fiscalyear_creation_months_before(self):
    for company in self:
        if company.fiscalyear_creation_months_before < 0 or company.fiscalyear_creation_months_before > 12:
            raise ValidationError(
                _("Payroll fiscal year creation months before must be between 0 and 12.")
            )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that and I changed the code. Thank you!

@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-imp-hr_perioll_period-cron-month branch from 445e335 to 9c988fd Compare October 3, 2025 06:39
@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-imp-hr_perioll_period-cron-month branch from 9c988fd to 708eabb Compare October 3, 2025 06:42
@github-actions
Copy link

github-actions bot commented Feb 8, 2026

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants