-
-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
028347a
commit 355f2a4
Showing
20 changed files
with
1,095 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,101 @@ | ||
======================== | ||
Hr Maintenance Workspace | ||
======================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.0/hr_maintenance_workspace | ||
:alt: OCA/hr | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_maintenance_workspace | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/hr&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Allows to associate employees and equipments to workspaces. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Implemented Uses | ||
================ | ||
|
||
**Employees** | ||
|
||
* Employees can be assigned to workspaces. | ||
|
||
**Workspaces** | ||
|
||
* Each workspace has employees and equipment asigned to it. It represents a real workspace. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_maintenance_workspace%0Aversion:%2014.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 | ||
~~~~~~~ | ||
|
||
* SDi Digital Group | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Valentín Georgian Castravete <valentincastravete@gmail.com> | ||
* Jorge Luis Quinteros <quinterosorellana04@gmail.com> | ||
|
||
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. | ||
|
||
.. |maintainer-valentincastravete| image:: https://github.com/valentincastravete.png?size=40px | ||
:target: https://github.com/valentincastravete | ||
:alt: valentincastravete | ||
.. |maintainer-JorgeQuinteros| image:: https://github.com/JorgeQuinteros.png?size=40px | ||
:target: https://github.com/JorgeQuinteros | ||
:alt: JorgeQuinteros | ||
|
||
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-valentincastravete| |maintainer-JorgeQuinteros| | ||
|
||
This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/14.0/hr_maintenance_workspace>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains 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 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,20 @@ | ||
# Copyright 2023 SDi Digital Group (https://www.sdi.es/odoo-cloud) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Hr Maintenance Workspace", | ||
"summary": "Allows to assign equipments and employees to workspaces.", | ||
"version": "14.0.1.0.0", | ||
"category": "Human Resources", | ||
"website": "https://github.com/OCA/hr", | ||
"author": "SDi Digital Group, Odoo Community Association (OCA)", | ||
"maintainers": ["valentincastravete", "JorgeQuinteros"], | ||
"license": "AGPL-3", | ||
"depends": ["hr_maintenance"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"views/maintenance_views.xml", | ||
"views/maintenance_workspace_views.xml", | ||
"views/hr_maintenance_workspace_menu_views.xml", | ||
"views/hr_employee_views.xml", | ||
], | ||
} |
This file contains 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 @@ | ||
from . import equipment | ||
from . import hr_employee | ||
from . import workspace |
This file contains 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,34 @@ | ||
# Copyright 2023 SDi Digital Group (https://www.sdi.es/odoo-cloud) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class MaintenanceEquipment(models.Model): | ||
_inherit = "maintenance.equipment" | ||
|
||
workspace_id = fields.Many2one( | ||
comodel_name="maintenance.workspace", | ||
string="Workspace", | ||
tracking=True, | ||
) | ||
equipment_assign_to = fields.Selection( | ||
selection_add=[("workspace", "Workspace"), ("other", "Other")], | ||
ondelete={ | ||
"workspace": "set default", | ||
"other": "set default", | ||
}, | ||
) | ||
|
||
@api.depends("equipment_assign_to") | ||
def _compute_equipment_assign(self): | ||
super()._compute_equipment_assign() | ||
for equipment in self: | ||
if equipment.equipment_assign_to in ["employee", "department"]: | ||
equipment.workspace_id = False | ||
elif equipment.equipment_assign_to == "workspace": | ||
equipment.workspace_id = equipment.workspace_id | ||
equipment.department_id = False | ||
equipment.employee_id = False | ||
else: | ||
equipment.workspace_id = equipment.workspace_id |
This file contains 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,31 @@ | ||
# Copyright 2023 SDi Digital Group (https://www.sdi.es/odoo-cloud) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import _, api, fields, models | ||
|
||
|
||
class HrEmployee(models.Model): | ||
_inherit = "hr.employee" | ||
|
||
workspace_ids = fields.Many2many( | ||
comodel_name="maintenance.workspace", | ||
string="Workspaces", | ||
) | ||
workspace_count = fields.Integer( | ||
name="Workspaces", | ||
compute="_compute_workspace_count", | ||
) | ||
|
||
@api.depends("workspace_ids") | ||
def _compute_workspace_count(self): | ||
for employee in self: | ||
employee.workspace_count = len(employee.workspace_ids) | ||
|
||
def button_employee_workspaces(self): | ||
return { | ||
"name": _("Workspaces"), | ||
"view_mode": "tree,form", | ||
"res_model": "maintenance.workspace", | ||
"type": "ir.actions.act_window", | ||
"domain": [("employee_ids", "=", self.id)], | ||
} |
This file contains 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,74 @@ | ||
# Copyright 2023 SDi Digital Group (https://www.sdi.es/odoo-cloud) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class Workspace(models.Model): | ||
_name = "maintenance.workspace" | ||
_inherit = "mail.thread" | ||
_description = "Workspace" | ||
|
||
name = fields.Char( | ||
string="Name", | ||
required=True, | ||
) | ||
description = fields.Char( | ||
string="Description", | ||
) | ||
location = fields.Char( | ||
string="Location", | ||
) | ||
equipment_ids = fields.One2many( | ||
comodel_name="maintenance.equipment", | ||
inverse_name="workspace_id", | ||
) | ||
equipment_count = fields.Integer( | ||
name="Equipments", | ||
compute="_compute_equipment_count", | ||
store=True, | ||
) | ||
employee_ids = fields.Many2many( | ||
comodel_name="hr.employee", | ||
string="Employees", | ||
) | ||
employee_count = fields.Integer( | ||
string="Employee count", | ||
compute="_compute_employee_count", | ||
store=True, | ||
) | ||
employee_equipment_count = fields.Integer( | ||
string="Employee Equipment Count", | ||
compute="_compute_employee_equipment_count", | ||
store=True, | ||
) | ||
|
||
@api.depends("equipment_ids") | ||
def _compute_equipment_count(self): | ||
for workspace in self: | ||
workspace.equipment_count = len(workspace.equipment_ids) | ||
|
||
@api.depends("employee_ids") | ||
def _compute_employee_count(self): | ||
for workspace in self: | ||
workspace.employee_count = len(workspace.employee_ids) | ||
|
||
@api.depends("employee_ids", "employee_ids.equipment_ids") | ||
def _compute_employee_equipment_count(self): | ||
for workspace in self: | ||
workspace_empl_equipment_count = 0 | ||
if len(workspace.employee_ids) > 0: | ||
for employee in workspace.employee_ids: | ||
equipment_count = len(employee.equipment_ids) | ||
workspace_empl_equipment_count += equipment_count | ||
workspace.employee_equipment_count = workspace_empl_equipment_count | ||
|
||
def button_employee_equipment_count(self): | ||
return { | ||
"name": "Employee Equipments", | ||
"view_type": "form", | ||
"view_mode": "tree,form", | ||
"res_model": "maintenance.equipment", | ||
"type": "ir.actions.act_window", | ||
"domain": [("employee_id", "in", self.employee_ids.ids)], | ||
} |
This file contains 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 @@ | ||
* Valentín Georgian Castravete <valentincastravete@gmail.com> | ||
* Jorge Luis Quinteros <quinterosorellana04@gmail.com> |
This file contains 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 @@ | ||
Allows to associate employees and equipments to workspaces. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Implemented Uses | ||
================ | ||
|
||
**Employees** | ||
|
||
* Employees can be assigned to workspaces. | ||
|
||
**Workspaces** | ||
|
||
* Each workspace has employees and equipment asigned to it. It represents a real workspace. |
This file contains 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 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_workspace_user,workspace.user,model_maintenance_workspace,base.group_user,1,0,0,0 | ||
access_workspace_admin_user,workspace.admin.user,model_maintenance_workspace,maintenance.group_equipment_manager,1,1,1,1 |
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.