OCA / account-financial-tools

Odoo Accountant Financial Tools and Utils
GNU Affero General Public License v3.0
300 stars 741 forks source link

[14.0]account_lock_to_date : Error when defining new lock to date #1844

Open olimalt opened 3 months ago

olimalt commented 3 months ago

Module

account_lock_to_date

Describe the bug

When we change the lock to date for a new one (after the old one) it launches the error "The new lock to date for advisors must be set after the previous lock to date"

To Reproduce

Define a lock to date and make another one after the previous one and you get the error.

Affected versions: 14.0 and probably 15.0

Expected behavior It should let you define a date that is after the old one

Additional context it is in this code :

File : account_lock_to_date/models/res_company.py

if (
                old_fiscalyear_lock_to_date
                and fiscalyear_lock_to_date
                and fiscalyear_lock_to_date > old_fiscalyear_lock_to_date
            ):
                raise ValidationError(
                    _(
                        "The new lock to date for advisors must be set after "
                        "the previous lock to date."
                    )
                )

It should be the raised the ValidationError if the fiscalyear_lock_to_date < old_fiscalyear_lock_to_date

If someone could fix it please :)