-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FW][FIX] hr_timesheet: avoid setting an archived employee to a timesheet in the form view #95016
Conversation
This PR targets saas-15.2 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
The current PR is stuck because of the corresponding PR failing a test (https://github.com/odoo/enterprise/pull/28999). During the hiring process the employee is not active but we already try to create his holiday timesheets. After discussion with the PO we will add a check for employee activity before creating timesheets at employee creation. To have a consistent behavior we will also create/delete the public holiday timesheets when the employee is archived/unarchived. |
This PR was modified / updated and has become a normal PR. It should be merged the normal way (via @robodoo) |
Thanks for the changes, but have you check if the issue is not there in 15? 🤔 |
Yes I just tested on runbot 15.0 and the issue is there so it should be fixed this week or people are going to complain that the salary configurator does not work anymore, it's strange that the test did not fail in 15.0 as it already existed 🤔 I thought we only had the issue in 15.2 because holiday timesheet generation for new employee was added there 😅 but it was added in 15.0. Should I make a new pr to backport the second commit on 15.0 and 15.1? |
Probably because there is no global time off in the future in the test. Indeed, you have to create a PR in 15 to fix the issue as quick as possible. |
… in the form view Steps to reproduce: - Install timesheet - Archive an employee - Create a timesheet Current behavior: You can select the archived employee Expected behavior: You can not select the archived employee Explanation: In commit 17b2b07 the employee_id field of the timesheet was set to have context active_test to false. To fix this issue we reset the context for this field in every timesheet form and we add user errors if the employee is not active while the timesheet is created or edited. opw-2887727 opw-2870739 X-original-commit: d5ac8e0
19b5e8e
to
0fae9e5
Compare
…heets Before this commit, when the employee is generated with the salary configurator, the employee is archived since the employee will not directly start in the company. Even if the employee is archived and the timesheets are generated for this employee based on the global time offs found in the future. The problem is the timesheets cannot be created for archived employees and so a user error is raised. This problem could also happen if the user creates an archived employee. This commit fixes the issue by preventing the timesheets generation when the employee created is archived. When this employee will be updated and active field will be set to True, the timesheets generation will be applied. In the inverse use case, when the user will archive an employee and timesheets generated for the future global time offs will be removed. opw-2887727 opw-2870739
0fae9e5
to
8e4b6c5
Compare
@robodoo rebase-ff r+ |
Merge method set to rebase and fast-forward |
… in the form view Steps to reproduce: - Install timesheet - Archive an employee - Create a timesheet Current behavior: You can select the archived employee Expected behavior: You can not select the archived employee Explanation: In commit 17b2b07 the employee_id field of the timesheet was set to have context active_test to false. To fix this issue we reset the context for this field in every timesheet form and we add user errors if the employee is not active while the timesheet is created or edited. opw-2887727 opw-2870739 X-original-commit: d5ac8e0 Part-of: #95016
…heets Before this commit, when the employee is generated with the salary configurator, the employee is archived since the employee will not directly start in the company. Even if the employee is archived and the timesheets are generated for this employee based on the global time offs found in the future. The problem is the timesheets cannot be created for archived employees and so a user error is raised. This problem could also happen if the user creates an archived employee. This commit fixes the issue by preventing the timesheets generation when the employee created is archived. When this employee will be updated and active field will be set to True, the timesheets generation will be applied. In the inverse use case, when the user will archive an employee and timesheets generated for the future global time offs will be removed. opw-2887727 opw-2870739 closes #95016 Related: odoo/enterprise#28999 Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com> Signed-off-by: Xavier <xbo@odoo.com>
Steps to reproduce:
Current behavior:
You can select the archived employee
Expected behavior:
You can not select the archived employee
Explanation:
In commit 17b2b07 the employee_id
field of the timesheet was set to have context active_test to false.
To fix this issue we reset the context for this field in every
timesheet form.
A task exist to fix the issue on master id 2884736
opw-2887727
opw-2870739
Second commit:
Previously we had an issue as we created an employee we
also created holiday timesheets for the employee even
if this employee was not active (for example a candidate
in the hiring process) so we had to restrict the creation
of holiday timesheets on employee creation to active
employees.
Doing so we needed for a candidate that succeeded the hiring
process to have his holiday timesheets created. That why we
overwrite the write function and add the behavior that when
an employee is set to active (unactive) his future public
holiday timesheets are created (deleted).
Forward-Port-Of: #94308