From 254a72a6911e10589d89bbf0d4861adea8be3354 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Fri, 1 Nov 2024 13:57:26 +0200 Subject: [PATCH] [17.0][ADD] hr_recruitment_stage_active --- hr_recruitment_stage_active/README.rst | 78 +++++++++++++++++++ hr_recruitment_stage_active/__init__.py | 1 + hr_recruitment_stage_active/__manifest__.py | 18 +++++ .../models/__init__.py | 1 + .../models/hr_recruitment_stage.py | 14 ++++ hr_recruitment_stage_active/pyproject.toml | 3 + hr_recruitment_stage_active/tests/__init__.py | 1 + .../tests/test_recruitment_stage.py | 17 ++++ .../views/hr_recruitment_stage.xml | 48 ++++++++++++ 9 files changed, 181 insertions(+) create mode 100644 hr_recruitment_stage_active/README.rst create mode 100644 hr_recruitment_stage_active/__init__.py create mode 100644 hr_recruitment_stage_active/__manifest__.py create mode 100644 hr_recruitment_stage_active/models/__init__.py create mode 100644 hr_recruitment_stage_active/models/hr_recruitment_stage.py create mode 100644 hr_recruitment_stage_active/pyproject.toml create mode 100644 hr_recruitment_stage_active/tests/__init__.py create mode 100644 hr_recruitment_stage_active/tests/test_recruitment_stage.py create mode 100644 hr_recruitment_stage_active/views/hr_recruitment_stage.xml diff --git a/hr_recruitment_stage_active/README.rst b/hr_recruitment_stage_active/README.rst new file mode 100644 index 00000000000..251990a0208 --- /dev/null +++ b/hr_recruitment_stage_active/README.rst @@ -0,0 +1,78 @@ +=========================== +HR Recruitment Stage Active +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bb6a35ee508aab10187b2af31f33313b34800356b7b63b84ca5cf0d4cf711da7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_recruitment_stage_active + :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_recruitment_stage_active + :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| + +Adds an ``Active`` field to the ``hr.recruitment.stage`` model to be able to deactivate stages without deleting them + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Archive/unarchive recruitment stages. + +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 +======= + +Contributors +------------ + +- ``Camptocamp ``\ \_\_: + + - Maksym Yankin maksym.yankin@camptocamp.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. + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_recruitment_stage_active/__init__.py b/hr_recruitment_stage_active/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/hr_recruitment_stage_active/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/hr_recruitment_stage_active/__manifest__.py b/hr_recruitment_stage_active/__manifest__.py new file mode 100644 index 00000000000..10178d413f6 --- /dev/null +++ b/hr_recruitment_stage_active/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "HR Recruitment Stage Active", + "version": "17.0.1.0.0", + "author": "Odoo Community Association (OCA), Camptocamp", + "license": "AGPL-3", + "category": "Human Resources/Recruitment", + "website": "https://github.com/OCA/hr", + "depends": [ + # odoo + "hr_recruitment", + ], + "data": [ + "views/hr_recruitment_stage.xml", + ], + "installable": True, +} diff --git a/hr_recruitment_stage_active/models/__init__.py b/hr_recruitment_stage_active/models/__init__.py new file mode 100644 index 00000000000..533dfe29148 --- /dev/null +++ b/hr_recruitment_stage_active/models/__init__.py @@ -0,0 +1 @@ +from . import hr_recruitment_stage diff --git a/hr_recruitment_stage_active/models/hr_recruitment_stage.py b/hr_recruitment_stage_active/models/hr_recruitment_stage.py new file mode 100644 index 00000000000..297ff56fe68 --- /dev/null +++ b/hr_recruitment_stage_active/models/hr_recruitment_stage.py @@ -0,0 +1,14 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class RecruitmentStage(models.Model): + _inherit = "hr.recruitment.stage" + + active = fields.Boolean( + help="The active field allows you to hide the stage without removing it.", + default=True, + tracking=True, + ) diff --git a/hr_recruitment_stage_active/pyproject.toml b/hr_recruitment_stage_active/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/hr_recruitment_stage_active/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/hr_recruitment_stage_active/tests/__init__.py b/hr_recruitment_stage_active/tests/__init__.py new file mode 100644 index 00000000000..d6a3ce65c5b --- /dev/null +++ b/hr_recruitment_stage_active/tests/__init__.py @@ -0,0 +1 @@ +from . import test_recruitment_stage diff --git a/hr_recruitment_stage_active/tests/test_recruitment_stage.py b/hr_recruitment_stage_active/tests/test_recruitment_stage.py new file mode 100644 index 00000000000..d199f10c710 --- /dev/null +++ b/hr_recruitment_stage_active/tests/test_recruitment_stage.py @@ -0,0 +1,17 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestRecruitmentStage(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.RecruitmentStage = cls.env["hr.recruitment.stage"] + + def test_01_recruitment_stage(self): + stage = self.RecruitmentStage.create({"name": "Overloaded"}) + self.assertTrue(stage.active, "Stage should be active by default") + stage.action_archive() + self.assertFalse(stage.active, "Stage should be inactive after archiving") diff --git a/hr_recruitment_stage_active/views/hr_recruitment_stage.xml b/hr_recruitment_stage_active/views/hr_recruitment_stage.xml new file mode 100644 index 00000000000..20c337625e9 --- /dev/null +++ b/hr_recruitment_stage_active/views/hr_recruitment_stage.xml @@ -0,0 +1,48 @@ + + + + + hr.recruitment.stage + + + + + + + + + hr.recruitment.stage + + + + + + + + + + + + hr.recruitment.stage.search + hr.recruitment.stage + + + + + + + + +