-
-
Notifications
You must be signed in to change notification settings - Fork 719
[17.0][MIG] hr_holidays_team_manager: Migration to 17.0 #1450
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
Open
BhaveshHeliconia
wants to merge
7
commits into
OCA:17.0
Choose a base branch
from
HeliconiaIO:17.0-mig-hr_holidays_team_manager
base: 17.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c1c7be3
[ADD] hr_holidays_team_manager
Murtaza-OSI a1bd7a3
[UPD] Update hr_holidays_team_manager.pot
031e757
[BOT] post-merge updates
OCA-git-bot e5fe5e6
Added translation using Weblate (Italian)
mymage 3e147db
Translated using Weblate (Italian)
mymage b318fdd
[IMP] hr_holidays_team_manager: pre-commit auto fixes
BhaveshHeliconia c4971ed
[MIG] hr_holidays_team_manager: Migration to 17.0
BhaveshHeliconia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| ======================== | ||
| HR Holidays Team Manager | ||
| ======================== | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:f58b08309a0ee64587893004030bb9f490a487dabec4f41a792781b6528f5be2 | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Beta | ||
| .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
| .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/hr/tree/17.0/hr_holidays_team_manager | ||
| :alt: OCA/hr | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/hr-17-0/hr-17-0-hr_holidays_team_manager | ||
| :alt: Translate me on Weblate | ||
| .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
| :target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=17.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| Add a new group Time off/Team manager that can only view, write, and | ||
| create time off requests and time off assignment requests for employees | ||
| who belong to the same department | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| Add a new group Time off/Team manager that can only view, write, and | ||
| create time off requests and time off assignment requests for employees | ||
| who belong to the same department | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
| `feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_holidays_team_manager%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ------- | ||
|
|
||
| * Open Source Integrators | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| - Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com> | ||
| - `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__ | ||
|
|
||
| - Bhavesh Heliconia | ||
|
|
||
| Maintainers | ||
| ----------- | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use. | ||
|
|
||
| This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/17.0/hr_holidays_team_manager>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (C) 2024 - TODAY, Open Source Integrators | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "HR Holidays Team Manager", | ||
| "version": "17.0.1.0.0", | ||
| "license": "AGPL-3", | ||
| "author": "Open Source Integrators, " "Odoo Community Association (OCA)", | ||
| "maintainer": "Open Source Integrators", | ||
| "website": "https://github.com/OCA/hr", | ||
| "category": "HR", | ||
| "depends": ["hr_holidays"], | ||
| "data": [ | ||
| "data/hr_holidays_rules.xml", | ||
| "data/hr_holidays_security.xml", | ||
| "views/hr_leave_allocation_views.xml", | ||
| ], | ||
| "installable": True, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version='1.0' encoding='utf-8' ?> | ||
| <odoo> | ||
| <function name="write" model="ir.model.data"> | ||
| <value | ||
| model="ir.model.data" | ||
| search="[('module', '=', 'hr_holidays'), ('name', 'in',['hr_leave_rule_officer_update','hr_leave_allocation_rule_officer_read','hr_leave_allocation_rule_officer_update'])]" | ||
| /> | ||
| <value eval="{'noupdate': False}" /> | ||
| </function> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <?xml version='1.0' encoding='utf-8' ?> | ||
| <odoo> | ||
| <record id="hr_holidays.group_hr_holidays_user" model="res.groups"> | ||
| <field name="name">Time off/Team manager</field> | ||
| <field | ||
| name="rule_groups" | ||
| eval="[Command.set([ref('hr_holidays.resource_leaves_holidays_user'), ref('hr_holidays.hr_leave_report_rule_group_holiday_user')])]" | ||
| /> | ||
| </record> | ||
|
|
||
| <record id="group_hr_holidays_officer" model="res.groups"> | ||
| <field name="name">Time off/Holiday Officer</field> | ||
| <field | ||
| name="implied_ids" | ||
| eval="[Command.link(ref('hr_holidays.group_hr_holidays_user'))]" | ||
| /> | ||
| <field name="category_id" ref="base.module_category_human_resources_time_off" /> | ||
| <field | ||
| name="rule_groups" | ||
| eval="[Command.set([ref('hr_holidays.hr_leave_allocation_rule_officer_update'), ref('hr_holidays.hr_leave_rule_officer_update'),ref('hr_holidays.hr_leave_allocation_rule_officer_read'),ref('hr_holidays.hr_leave_rule_user_read')])]" | ||
| /> | ||
| </record> | ||
|
|
||
| <record id="hr_holidays.group_hr_holidays_manager" model="res.groups"> | ||
| <field | ||
| name="implied_ids" | ||
| eval="[Command.set([ref('hr_holidays_team_manager.group_hr_holidays_officer')])]" | ||
| /> | ||
| </record> | ||
|
|
||
| <record id="team_manager_time_off_same_department" model="ir.rule"> | ||
| <field name="name">Time off: Team manager time off same department</field> | ||
| <field name="model_id" ref="hr_holidays.model_hr_leave" /> | ||
| <field name="domain_force">['|', | ||
| ('employee_id.department_id', 'in',[user.employee_ids.department_id.id]), | ||
| ('employee_ids.department_id', 'in', [user.employee_ids.department_id.id])] | ||
| </field> | ||
| <field | ||
| name="groups" | ||
| eval="[Command.link(ref('hr_holidays.group_hr_holidays_user'))]" | ||
| /> | ||
| <field name="perm_read" eval="True" /> | ||
| <field name="perm_create" eval="True" /> | ||
| <field name="perm_write" eval="True" /> | ||
| <field name="perm_unlink" eval="True" /> | ||
| </record> | ||
|
|
||
|
|
||
| <record id="team_manager_time_off_allocation_same_department" model="ir.rule"> | ||
| <field | ||
| name="name" | ||
| >Time off: Team manager time off allocation same department</field> | ||
| <field name="model_id" ref="hr_holidays.model_hr_leave_allocation" /> | ||
| <field name="domain_force">['|', | ||
| ('employee_id.department_id', 'in', [user.employee_ids.department_id.id]), | ||
| ('employee_ids.department_id', 'in',[user.employee_ids.department_id.id])]</field> | ||
| <field | ||
| name="groups" | ||
| eval="[Command.link(ref('hr_holidays.group_hr_holidays_user'))]" | ||
| /> | ||
| <field name="perm_read" eval="True" /> | ||
| <field name="perm_create" eval="True" /> | ||
| <field name="perm_write" eval="True" /> | ||
| <field name="perm_unlink" eval="True" /> | ||
| </record> | ||
| </odoo> | ||
36 changes: 36 additions & 0 deletions
36
hr_holidays_team_manager/i18n/hr_holidays_team_manager.pot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * hr_holidays_team_manager | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 16.0\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "Last-Translator: \n" | ||
| "Language-Team: \n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: \n" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #: model:ir.model,name:hr_holidays_team_manager.model_hr_employee_base | ||
| msgid "Basic Employee" | ||
| msgstr "" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #. odoo-python | ||
| #: code:addons/hr_holidays_team_manager/models/hr_leave_allocation.py:0 | ||
| #, python-format | ||
| msgid "Team managers can't approve time off allocations" | ||
| msgstr "" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #: model:ir.model,name:hr_holidays_team_manager.model_hr_leave_allocation | ||
| msgid "Time Off Allocation" | ||
| msgstr "" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #: model:res.groups,name:hr_holidays_team_manager.group_hr_holidays_officer | ||
| msgid "Time off/Holiday Officer" | ||
| msgstr "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * hr_holidays_team_manager | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 16.0\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "PO-Revision-Date: 2024-12-09 11:06+0000\n" | ||
| "Last-Translator: mymage <stefano.consolaro@mymage.it>\n" | ||
| "Language-Team: none\n" | ||
| "Language: it\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
| "X-Generator: Weblate 5.6.2\n" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #: model:ir.model,name:hr_holidays_team_manager.model_hr_employee_base | ||
| msgid "Basic Employee" | ||
| msgstr "Dipendente base" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #. odoo-python | ||
| #: code:addons/hr_holidays_team_manager/models/hr_leave_allocation.py:0 | ||
| #, python-format | ||
| msgid "Team managers can't approve time off allocations" | ||
| msgstr "I manager del gruppo non possono approvare le allocazioni delle assenze" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #: model:ir.model,name:hr_holidays_team_manager.model_hr_leave_allocation | ||
| msgid "Time Off Allocation" | ||
| msgstr "Allocazione assenza" | ||
|
|
||
| #. module: hr_holidays_team_manager | ||
| #: model:res.groups,name:hr_holidays_team_manager.group_hr_holidays_officer | ||
| msgid "Time off/Holiday Officer" | ||
| msgstr "Funzionario assenze/ferie" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from . import hr_employee_base | ||
| from . import hr_leave_allocation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
||
| from odoo import api, models | ||
|
|
||
|
|
||
| class HrEmployeeBase(models.AbstractModel): | ||
| _inherit = "hr.employee.base" | ||
|
|
||
| def search(self, domain, offset=0, limit=None, order=None): | ||
| params = self.env.context.get("params") | ||
| if params: | ||
| model = params.get("model") | ||
| if not self.env.context.get("by_pass"): | ||
| if ( | ||
| model in ["hr.leave", "hr.leave.allocation"] | ||
| and self.env.user.has_group("hr_holidays.group_hr_holidays_user") | ||
| and not self.env.user.has_group( | ||
| "hr_holidays_team_manager.group_hr_holidays_officer" | ||
| ) | ||
| ): | ||
| if domain is None: | ||
| domain = [] | ||
| employee_id = self.env.user.with_context(by_pass=True).employee_ids | ||
| if employee_id: | ||
| domain += [ | ||
| ("department_id", "=", employee_id[0].department_id.id) | ||
| ] | ||
|
|
||
| return super().search(domain, offset=offset, limit=limit, order=order) | ||
|
|
||
| @api.model | ||
| def name_search(self, name="", args=None, operator="ilike", limit=100): | ||
| context = self.env.context | ||
| if context: | ||
| if not self.env.context.get("by_pass"): | ||
| if ( | ||
| [context.get("hr_leave_allocation") or context.get("hr_leave")] | ||
| and self.env.user.has_group("hr_holidays.group_hr_holidays_user") | ||
| and not self.env.user.has_group( | ||
| "hr_holidays_team_manager.group_hr_holidays_officer" | ||
| ) | ||
| ): | ||
| if args is None: | ||
| args = [] | ||
| employee_id = self.env.user.with_context(by_pass=True).employee_ids | ||
| if employee_id: | ||
| args += [ | ||
| ("department_id", "=", employee_id[0].department_id.id) | ||
| ] | ||
|
|
||
| return super().name_search(name=name, args=args, operator=operator, limit=limit) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
||
| from odoo import _, models | ||
| from odoo.exceptions import ValidationError | ||
|
|
||
|
|
||
| class HolidaysAllocation(models.Model): | ||
| _inherit = "hr.leave.allocation" | ||
|
|
||
| def action_validate(self): | ||
| if self.env.user.has_group( | ||
| "hr_holidays.group_hr_holidays_user" | ||
| ) and not self.env.user.has_group( | ||
| "hr_holidays_team_manager.group_hr_holidays_officer" | ||
| ): | ||
| raise ValidationError(_("Team managers can't approve time off allocations")) | ||
| return super().action_validate() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [build-system] | ||
| requires = ["whool"] | ||
| build-backend = "whool.buildapi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| - Murtaza Mithaiwala \<<mmithaiwala@opensourceintegrators.com>\> | ||
| - [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) | ||
| - Bhavesh Heliconia |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Add a new group Time off/Team manager that can only view, write, and | ||
| create time off requests and time off assignment requests for employees | ||
| who belong to the same department |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Add a new group Time off/Team manager that can only view, write, and | ||
| create time off requests and time off assignment requests for employees | ||
| who belong to the same department |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 16.0 this was
(4, ref('hr_holidays.group_hr_holidays_user'))which uses link/add semantics.Command.set()replaces all implied groups, which could remove implied groups added by other installed modules. Should this beCommand.link(ref('hr_holidays.group_hr_holidays_user'))instead to preserve the original behavior?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right — it should use
Command.link()to preserve the original link semantics.I've replaced
Command.set(ref('hr_holidays.group_hr_holidays_user'))withCommand.link(ref('hr_holidays.group_hr_holidays_user')).Thanks for pointing this out and for the review.