Skip to content

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants