[15.0][IMP] hr_payroll_period: add a company parameter to select the months in advance for creating the new HR periods #217
Conversation
|
Hi @nimarosa, |
| class ResCompany(models.Model): | ||
| _inherit = "res.company" | ||
|
|
||
| fiscalyear_creation_months_before = fields.Integer( |
There was a problem hiding this comment.
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.")
)
There was a problem hiding this comment.
I agree with that and I changed the code. Thank you!
445e335 to
9c988fd
Compare
… in advance for creating the new HR periods
9c988fd to
708eabb
Compare
|
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. |
Currently users cannot select how much in advance the periods are created.
I can put days instead of months...