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

[16.0] hr_holidays_public: Deprecate use of employee_id in favour of partner_id #110

Conversation

grindtildeath
Copy link

Helper functions to find public holidays did allow to use an hr.employee to filter country and states based on the employee address.

Since only the address of the employee was used, modifying the functions to use a res.partner instead of an hr.employee allows more possibilities such as checking public holidays for customers and suppliers.

# TODO: Drop function in next migration
employee = False
partner = False
if employee_id is not None:
Copy link
Member

Choose a reason for hiding this comment

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

what if you call this method with (False, False) ?

Copy link
Author

Choose a reason for hiding this comment

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

From where it's called, it's supposed to have a value or be None, so no need to handle such a case

@grindtildeath grindtildeath force-pushed the 16.0-imp-hr_holidays_partner_deprecate_employee branch from 586110e to 8e940f5 Compare February 21, 2024 19:11
@pedrobaeza pedrobaeza added this to the 16.0 milestone Mar 4, 2024
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.

Can you please explain the rationale behind this change?

@jbaudoux
Copy link

jbaudoux commented Mar 4, 2024

Can you please explain the rationale behind this change?

We need this for planning the shipments to the customers. Some (country) state have specific bank holidays and we need to plan transport accordingly

@cyrilmanuel
Copy link

Hello @pedrobaeza little ping to know if it can be merge :)

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.

After analyzing this, it's a bit weird to have something prefixed with hr, but using a partner, but it's OK if you don't deprecate ever the employee_id argument. It may be needed because in any override, you may have some information on the employee that vary the result. Losing the argument, you won't be able to access to this info.

hr_holidays_public/models/hr_holidays_public.py Outdated Show resolved Hide resolved
hr_holidays_public/models/hr_holidays_public.py Outdated Show resolved Hide resolved
Helper functions to find public holidays did allow to use an hr.employee
to filter country and states based on the employee address.

Since only the address of the employee was used, modifying the functions
to use a res.partner instead of an hr.employee allows more possibilities
such as checking public holidays for customers and suppliers.
@grindtildeath grindtildeath force-pushed the 16.0-imp-hr_holidays_partner_deprecate_employee branch from 8e940f5 to 42ceea6 Compare May 6, 2024 14:00
@grindtildeath
Copy link
Author

@pedrobaeza I kept the possiblity to use employee_id on purpose to avoid any breaking change in a release version.

IMO for future versions public holidays should be taken out of the hr module as it's not necessarily linked only to hr. We could have a calendar_holidays_public module and then we could bridge the gap to the hr keeping hr_holidays_public.

@grindtildeath
Copy link
Author

@pedrobaeza Can you please update your review?

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.

OK, let's go with the split in future version.

/ocabot merge major

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-110-by-pedrobaeza-bump-major, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 2006e02 into OCA:16.0 May 13, 2024
5 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at cef403f. 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.

7 participants