diff --git a/hr_operating_unit/README.rst b/hr_operating_unit/README.rst new file mode 100644 index 0000000000..2dfc1ead38 --- /dev/null +++ b/hr_operating_unit/README.rst @@ -0,0 +1,88 @@ +================= +HR Operating Unit +================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7a28b5b0010fef71cb3aeeef054968566d9ee77d20bee632840b88b7029e328e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Foperating--unit-lightgray.png?logo=github + :target: https://github.com/OCA/operating-unit/tree/18.0/hr_operating_unit + :alt: OCA/operating-unit +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/operating-unit-18-0/operating-unit-18-0-hr_operating_unit + :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/operating-unit&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module introduces the following features: + +- Adds the Operating Unit (OU) to the Employee. +- The Employees's default Operating Unit (OU) is proposed at the time of + creation getting it from the logged user. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Add the operating unit to Employee + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Gonzalo González Domínguez + +Contributors +------------ + +- Gonzalo González Domínguez +- Murtaza Mithaiwala +- Tran Thanh Trai +- ``Heliconia Solutions Pvt. Ltd. ``\ \_ + +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/operating-unit `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_operating_unit/__init__.py b/hr_operating_unit/__init__.py new file mode 100644 index 0000000000..31660d6a96 --- /dev/null +++ b/hr_operating_unit/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/hr_operating_unit/__manifest__.py b/hr_operating_unit/__manifest__.py new file mode 100644 index 0000000000..34d4d2a550 --- /dev/null +++ b/hr_operating_unit/__manifest__.py @@ -0,0 +1,16 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "HR Operating Unit", + "version": "18.0.1.0.0", + "author": "Gonzalo González Domínguez, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/operating-unit", + "category": "Human Resources", + "depends": ["hr", "operating_unit"], + "data": [ + "security/security.xml", + "views/hr_employee.xml", + ], + "installable": True, +} diff --git a/hr_operating_unit/i18n/es.po b/hr_operating_unit/i18n/es.po new file mode 100644 index 0000000000..a7676c2e42 --- /dev/null +++ b/hr_operating_unit/i18n/es.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-05-13 11:03+0000\n" +"PO-Revision-Date: 2019-05-13 11:03+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_hr_employee_base +msgid "Basic Employee" +msgstr "" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__default_operating_unit_id +#: model_terms:ir.ui.view,arch_db:hr_operating_unit.view_employee_filter +msgid "Default Operating Unit" +msgstr "Unidad Operativa Actual" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_operating_unit__employee_ids +msgid "Employees Allowed" +msgstr "Empleados Permitidos" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "Unidad Operativa" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__operating_unit_ids +msgid "Operating Units" +msgstr "Unidades Operativas" + +#~ msgid "Employee" +#~ msgstr "Empleado" diff --git a/hr_operating_unit/i18n/fr.po b/hr_operating_unit/i18n/fr.po new file mode 100644 index 0000000000..7315a0ecbe --- /dev/null +++ b/hr_operating_unit/i18n/fr.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-06-28 11:05+0000\n" +"Last-Translator: Khalid Hazam \n" +"Language-Team: none\n" +"Language: fr\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 4.3.2\n" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_hr_employee_base +#, fuzzy +msgid "Basic Employee" +msgstr "Employer" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__default_operating_unit_id +#: model_terms:ir.ui.view,arch_db:hr_operating_unit.view_employee_filter +msgid "Default Operating Unit" +msgstr "Unité opérationnelle par défaut" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_operating_unit__employee_ids +msgid "Employees Allowed" +msgstr "Employés autorisés" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "Unité opérationnelle" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__operating_unit_ids +msgid "Operating Units" +msgstr "Unités opérationnelles" + +#~ msgid "Display Name" +#~ msgstr "Nom affiché" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Dernière modification le" diff --git a/hr_operating_unit/i18n/hr_operating_unit.pot b/hr_operating_unit/i18n/hr_operating_unit.pot new file mode 100644 index 0000000000..095466616b --- /dev/null +++ b/hr_operating_unit/i18n/hr_operating_unit.pot @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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_operating_unit +#: model:ir.model,name:hr_operating_unit.model_hr_employee_base +msgid "Basic Employee" +msgstr "" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__default_operating_unit_id +#: model_terms:ir.ui.view,arch_db:hr_operating_unit.view_employee_filter +msgid "Default Operating Unit" +msgstr "" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_operating_unit__employee_ids +msgid "Employees Allowed" +msgstr "" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__operating_unit_ids +msgid "Operating Units" +msgstr "" diff --git a/hr_operating_unit/i18n/it.po b/hr_operating_unit/i18n/it.po new file mode 100644 index 0000000000..3c3b88e786 --- /dev/null +++ b/hr_operating_unit/i18n/it.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-26 15:33+0000\n" +"Last-Translator: mymage \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 4.17\n" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_hr_employee_base +msgid "Basic Employee" +msgstr "Dipendente base" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__default_operating_unit_id +#: model_terms:ir.ui.view,arch_db:hr_operating_unit.view_employee_filter +msgid "Default Operating Unit" +msgstr "Unità operativa predefinita" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_operating_unit__employee_ids +msgid "Employees Allowed" +msgstr "Dipendenti autorizzati" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "Unità operativa" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__operating_unit_ids +msgid "Operating Units" +msgstr "Unità operative" diff --git a/hr_operating_unit/models/__init__.py b/hr_operating_unit/models/__init__.py new file mode 100644 index 0000000000..297b40f34f --- /dev/null +++ b/hr_operating_unit/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import hr_employee_base +from . import hr_operating_unit diff --git a/hr_operating_unit/models/hr_employee_base.py b/hr_operating_unit/models/hr_employee_base.py new file mode 100644 index 0000000000..492cbac482 --- /dev/null +++ b/hr_operating_unit/models/hr_employee_base.py @@ -0,0 +1,22 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class HrEmployeeBase(models.AbstractModel): + _inherit = "hr.employee.base" + + operating_unit_ids = fields.Many2many( + comodel_name="operating.unit", + relation="operating_unit_employees_rel", + column1="employee_id", + column2="operating_unit_id", + string="Operating Units", + default=lambda self: (self.env["res.users"]._get_default_operating_unit()), + ) + + default_operating_unit_id = fields.Many2one( + comodel_name="operating.unit", + string="Default Operating Unit", + default=lambda self: (self.env["res.users"]._get_default_operating_unit()), + ) diff --git a/hr_operating_unit/models/hr_operating_unit.py b/hr_operating_unit/models/hr_operating_unit.py new file mode 100644 index 0000000000..c6fbffff5d --- /dev/null +++ b/hr_operating_unit/models/hr_operating_unit.py @@ -0,0 +1,15 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class OperatingUnit(models.Model): + _inherit = "operating.unit" + + employee_ids = fields.Many2many( + comodel_name="hr.employee", + relation="operating_unit_employees_rel", + column1="operating_unit_id", + column2="employee_id", + string="Employees Allowed", + ) diff --git a/hr_operating_unit/pyproject.toml b/hr_operating_unit/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/hr_operating_unit/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/hr_operating_unit/readme/CONTRIBUTORS.md b/hr_operating_unit/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..caa0f62e20 --- /dev/null +++ b/hr_operating_unit/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- Gonzalo González Domínguez \<\> +- Murtaza Mithaiwala \<\> +- Tran Thanh Trai \<\> +- `Heliconia Solutions Pvt. Ltd. `_ diff --git a/hr_operating_unit/readme/DESCRIPTION.md b/hr_operating_unit/readme/DESCRIPTION.md new file mode 100644 index 0000000000..6baf3f5ea6 --- /dev/null +++ b/hr_operating_unit/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +This module introduces the following features: + +- Adds the Operating Unit (OU) to the Employee. +- The Employees's default Operating Unit (OU) is proposed at the time of + creation getting it from the logged user. diff --git a/hr_operating_unit/readme/USAGE.md b/hr_operating_unit/readme/USAGE.md new file mode 100644 index 0000000000..c22c0a5d4e --- /dev/null +++ b/hr_operating_unit/readme/USAGE.md @@ -0,0 +1 @@ +Add the operating unit to Employee diff --git a/hr_operating_unit/security/security.xml b/hr_operating_unit/security/security.xml new file mode 100644 index 0000000000..93ceea8b6d --- /dev/null +++ b/hr_operating_unit/security/security.xml @@ -0,0 +1,15 @@ + + + + + ['|',('default_operating_unit_id','=',False),('default_operating_unit_id','in', operating_unit_ids)] + Allowed Operating Units for Employee + + + + + + + diff --git a/hr_operating_unit/static/description/icon.png b/hr_operating_unit/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/hr_operating_unit/static/description/icon.png differ diff --git a/hr_operating_unit/static/description/index.html b/hr_operating_unit/static/description/index.html new file mode 100644 index 0000000000..7874178ebd --- /dev/null +++ b/hr_operating_unit/static/description/index.html @@ -0,0 +1,436 @@ + + + + + +HR Operating Unit + + + +
+

HR Operating Unit

+ + +

Beta License: AGPL-3 OCA/operating-unit Translate me on Weblate Try me on Runboat

+

This module introduces the following features:

+
    +
  • Adds the Operating Unit (OU) to the Employee.
  • +
  • The Employees’s default Operating Unit (OU) is proposed at the time of +creation getting it from the logged user.
  • +
+

Table of contents

+ +
+

Usage

+

Add the operating unit to Employee

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Gonzalo González Domínguez
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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/operating-unit project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/hr_operating_unit/views/hr_employee.xml b/hr_operating_unit/views/hr_employee.xml new file mode 100644 index 0000000000..8d9ea49755 --- /dev/null +++ b/hr_operating_unit/views/hr_employee.xml @@ -0,0 +1,64 @@ + + + + + hr.employee_tree + hr.employee + + + + + + + + + + hr.employee_form + hr.employee + + + + + + + + + + + + + hr.employee_filter + hr.employee + + + + + + + + + + +