Skip to content
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

[17.0][MIG] hr_employee_calendar_planning #1355

Merged

Conversation

pedro-evaristo-pegon
Copy link
Contributor

@pedro-evaristo-pegon pedro-evaristo-pegon commented May 23, 2024

Work done:

  • Adapting manifest.py version
  • Adapt employee public view as resource_calendar_id is not present on it anymore
  • On tests assert on number of attendances changed slightly because of the lunch break
  • On create redefinition adapted the employee calendar regeneration to avoid a singleton Value Error
  • Fix ruff B023, UP008, E501

pedrobaeza and others added 28 commits August 6, 2024 17:58
This module allows to manage employee working time with profiles by date
intervals.

The profiles are regular working time calendars, but they are treated as
master ones here, allowing you to compose complexes working times by dates.

Under the hook, a unique working time is created for each employee with the
proper composition for not affecting the rest of the functionality linked to
this model.

Installation
============

During the installation of the module, current working times are split by
start/end dates for having consistent data, and the potential new composed
calendar planning is saved instead on the employee.

Configuration
=============

1. Go to *Employees > Employees*.
2. Open or create a new one.
3. On the "Public Information" page, fill the section "Calendar planning" with:

   * Starting date (optional).
   * Ending date (optional).
   * Working time to apply during that date interval.

Known issues / Roadmap
======================

* Add a wizard for generating next year calendar planning based on current one
  in batch.
* Add constraint for avoiding planning lines overlapping.
* Avoid the regeneration of whole private calendars each time a change is
  detected.

[UPD] README.rst
[UPD] Update hr_employee_calendar_planning.pot
Add _description for model hr.employee.calendar to make it pass runbot.

[UPD] Update hr_employee_calendar_planning.pot
[UPD] Update hr_employee_calendar_planning.pot

[UPD] README.rst

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-13.0/hr-13.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-13-0/hr-13-0-hr_employee_calendar_planning/
- On the module init, existing employee calendar leaves should be linked
to the employee's new autocalendar.

hr_employee_calendar_planning 13.0.1.0.1
[UPD] Update hr_employee_calendar_planning.pot

[UPD] README.rst
Currently translated at 94.4% (17 of 18 strings)

Translation: hr-14.0/hr-14.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_calendar_planning/fr/
…r when is related to some employee

[UPD] Update hr_employee_calendar_planning.pot

hr_employee_calendar_planning 14.0.1.0.2

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-14.0/hr-14.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_calendar_planning/
… field in to show only allowed records according to company. Add constraint to prevent change avoid changing the company when the calendar is linked to an employee of another company.

[UPD] Update hr_employee_calendar_planning.pot

hr_employee_calendar_planning 14.0.1.1.0

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-14.0/hr-14.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_calendar_planning/
…even when calendar is not active.

TT31606

[UPD] Update hr_employee_calendar_planning.pot

[UPD] README.rst

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-14.0/hr-14.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_calendar_planning/
…weeks.

Regenerate automatic calendar correctly when calendars are 2 weeks old (or any of them are 2 weeks old).
TT32425
…r if calendars have been defined in employee creation.

TT32425

[UPD] README.rst
Currently translated at 100.0% (22 of 22 strings)

Translation: hr-14.0/hr-14.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_calendar_planning/ca/
…void create employees without calendar planing.

TT35897
hr_employee_calendar_planning 14.0.1.3.1

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-14.0/hr-14.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_calendar_planning/
Parent is not necessary on context, this returns the next error when you
try to select a calendar planning on the employee:
``Uncaught Error: NameError: name 'parent' is not defined``

hr_employee_calendar_planning 14.0.1.4.0
Currently translated at 100.0% (23 of 23 strings)

Translation: hr-14.0/hr-14.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_calendar_planning/es_AR/

hr_employee_calendar_planning 14.0.1.4.1
jonasbuchholz and others added 10 commits August 6, 2024 17:58
… by linking new leaves to auto-generated calendars on creation
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-16.0/hr-16.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_employee_calendar_planning/
Currently translated at 100.0% (24 of 24 strings)

Translation: hr-16.0/hr-16.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_employee_calendar_planning/es/
Currently translated at 100.0% (24 of 24 strings)

Translation: hr-16.0/hr-16.0-hr_employee_calendar_planning
Translate-URL: https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_employee_calendar_planning/it/
Only create and unlink necessary resource_calendar_leaves
@pedro-evaristo-pegon pedro-evaristo-pegon force-pushed the 17.0-mig-hr_employee_calendar_planning branch from 145eb2b to 7c0268c Compare August 6, 2024 16:01
@juanjosesegui-tecnativa
Copy link
Contributor

@pedrobaeza

Copy link
Contributor

@juanjosesegui-tecnativa juanjosesegui-tecnativa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TT50117

self.assertEqual(
len(self.employee.resource_calendar_id.attendance_ids), 20 + 6 * 2 + 2
len(self.employee.resource_calendar_id.attendance_ids), 30 + 6 * 2 + 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all these number changings? Can you please avoid change them? The test should be immutable as a check of the functionality is preserved (unless something involved with data initialization itself).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. The idea of a unitary test is to protect the technical evolution of the module. In this case the attendance_ids was changed because of the inclusion of the breaks... I do come back to you on Wednesday with concrete details of it as I did this work some time ago.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we are creating the calendar deterministically, so the number should be fixed. Maybe this version is adding calendar attendances entries automatically that changes this number, that you should remove or prevent to be created, or maybe you need to filter according the criteria to get the same number.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedrobaeza did a pre-filtering of those attendances

@pedrobaeza
Copy link
Member

/ocabot migration hr_employee_calendar_planning

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Aug 12, 2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file. This can't be merged with this file here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please remove it in the commit that is adding it (the "pre-commit auto fixes" one).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedrobaeza removed

@pedro-evaristo-pegon pedro-evaristo-pegon force-pushed the 17.0-mig-hr_employee_calendar_planning branch from 7c0268c to b140571 Compare August 14, 2024 13:01
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I think the tests and the diff is clearer now for knowing why the changes.

Thanks for all.

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-1355-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@OCA-git-bot OCA-git-bot merged commit 462b9a9 into OCA:17.0 Aug 14, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at f9bbfa2. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.