Daily updates from Odoo
Wednesday, August 7, 2024
1 change
Enhancements to existing features
Accounting lock dates are now handled through an updated wizard that supports separate sales and purchase locks, temporary exceptions, and a stricter hard lock date. This helps businesses protect closed periods while still allowing controlled corrections when needed, and fixes related lock date behavior for Employment Hero integrations.
Original PR description
### changes #### [FIX] l10n_employment_hero: fix lock date Currently there is an `@api.onchange` function on 'res.company'. It is supposed to ensure that the `employment_hero_lock_date` is not after…
### changes
#### [FIX] l10n_employment_hero: fix lock date
Currently there is an `@api.onchange` function on 'res.company'.
It is supposed to ensure that the `employment_hero_lock_date` is not after the `fiscalyear_lock_date`.
But this does not work at all since both lock dates are changed in different views / wizards.
In this commit:
- The broken onchange is removed.
- A constraint on `employment_hero_lock_date` is added
- A function is added to compute the needed date from the `employment_hero_lock_date` and the other relevant fiscal lock dates.
On the `employment_hero_lock_date` constraint:
It ensure that we do not set a Employment Hero Lock Date before the relevant fiscal Lock Dates.
This avoids unexpected behavior / user frustration; since we only start fetching from the maximum of both of these dates.
We accept that the Employment Hero Lock Date can get outdated in case we change the relevant fiscal Lock Dates:
The field is assumed to be mostly used when setting up the DB to fetch historical data.
#### [FIX] account_accountant: remove unused fields from settings
Currently the lock date fields are also on 'res.config.settings'.
They are not used or needed. They were removed from the view in commit 0bd56c92e4b776de6b460da56da2807cc7bc778c .
This commit removes these fields.
#### [IMP] account: rework lock dates and their wizard
In the associated community PR the lock dates were reworked.
I.e.
- The `period_lock_date` was replaced by `sale_lock_date` and `purchase_lock_date`.
- (Temporary) Lock Date Exceptions were added (new model)
They can be used to make changes to a locked period
- A `hard_lock_date` was added.
- It locks everything (like all the lock dates were set to that date).
- It does not allow exceptions.
- It cannot be decreased or removed.
See the community PR for details.
In this commit we adapt the enterprise code to the changes in community.
I.e. we change the lock date wizard:
- All the lock dates can be seen and set in the wizard.
- Exceptions are created when decreasing a lock date
- No exceptions are possible for the `hard_lock_date`
- When a lock date value is decreased in the wizard a line on the button appears.
There it can be selected
- who the exception applies to: me or everyone
- how long the exception is valid: 5 min, 15 min, 1 h, 24 h or forever
- (optional) reason
- In case an exception for everyone and forever is selected we change the lock date instead of creating an exception.
- In case there are active exceptions for a lock date there is a revoke button on the right side of the lock date.
It can be used to revoke the most permissive (minimal date) active exception for that lock date.
- In case there are draft entries in the period the user wants to lock a warning is displayed.
It is only blocking for the `hard_lock_date`.
### related PRs
community: https://github.com/odoo/odoo/pull/174004
upgrade: https://github.com/odoo/upgrade/pull/6295
### task
task-3891414