From 9862f9d1a4ec539f4f63d2a903e0a5f21308766c Mon Sep 17 00:00:00 2001 From: "Samuel Macias Oropeza (smo)" Date: Thu, 18 Apr 2024 11:12:55 -0600 Subject: [PATCH] [FIX] hr_employee_document_from_applicant --- .../README.rst | 99 +++++++++++++++++++ .../__init__.py | 4 + .../__manifest__.py | 15 +++ .../i18n/es_MX.po | 21 ++++ .../hr_employee_document_from_applicant.pot | 21 ++++ .../models/__init__.py | 4 + .../models/hr_employee.py | 30 ++++++ .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 2 + .../readme/USAGE.rst | 7 ++ .../hr_employee_document_from_applicant | 1 + .../setup.py | 6 ++ 12 files changed, 214 insertions(+) create mode 100644 hr_employee_document_from_applicant/README.rst create mode 100644 hr_employee_document_from_applicant/__init__.py create mode 100644 hr_employee_document_from_applicant/__manifest__.py create mode 100644 hr_employee_document_from_applicant/i18n/es_MX.po create mode 100644 hr_employee_document_from_applicant/i18n/hr_employee_document_from_applicant.pot create mode 100644 hr_employee_document_from_applicant/models/__init__.py create mode 100644 hr_employee_document_from_applicant/models/hr_employee.py create mode 100644 hr_employee_document_from_applicant/readme/CONTRIBUTORS.rst create mode 100644 hr_employee_document_from_applicant/readme/DESCRIPTION.rst create mode 100644 hr_employee_document_from_applicant/readme/USAGE.rst create mode 120000 setup/hr_employee_document_from_applicant/odoo/addons/hr_employee_document_from_applicant create mode 100644 setup/hr_employee_document_from_applicant/setup.py diff --git a/hr_employee_document_from_applicant/README.rst b/hr_employee_document_from_applicant/README.rst new file mode 100644 index 00000000000..bf35d510ca8 --- /dev/null +++ b/hr_employee_document_from_applicant/README.rst @@ -0,0 +1,99 @@ +=================================== +HR Employee Document from Applicant +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:f3e7c9fb6aaa448db3c633a73aefd374a333797c7857828e5c195c18c2823f1c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/hr_employee_document_from_applicant + :alt: OCA/hr +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_employee_document_from_applicant + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to move all the documents attached to a candidate to +the employee when the candidate is hired. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to Recruitment +* Create a job position and a candidate +* Attach documents to the candidate +* Move the candidate through the recruitment process until the "Create +employee" button appears to click on it +* Go to the newly created employee: all the documents of the candidate are +available + +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 +~~~~~~~ + +* Open Source Integrators + +Contributors +~~~~~~~~~~~~ + +* `Open Source Integrators `__ + + * Samuel Macias Oropeza + * Maxime Chambreuil + +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-ursais| image:: https://github.com/ursais.png?size=40px + :target: https://github.com/ursais + :alt: ursais + +Current `maintainer `__: + +|maintainer-ursais| + +This module is part of the `OCA/hr `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_employee_document_from_applicant/__init__.py b/hr_employee_document_from_applicant/__init__.py new file mode 100644 index 00000000000..09a8cc8fc4c --- /dev/null +++ b/hr_employee_document_from_applicant/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2024 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/hr_employee_document_from_applicant/__manifest__.py b/hr_employee_document_from_applicant/__manifest__.py new file mode 100644 index 00000000000..5753b977207 --- /dev/null +++ b/hr_employee_document_from_applicant/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright (C) 2024 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "HR Employee Document from Applicant", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "summary": "HR Employee Document from Applicant", + "author": "Odoo Community Association (OCA), Open Source Integrators", + "maintainer": "Open Source Integrators", + "website": "https://github.com/OCA/hr", + "depends": ["hr_employee_document", "hr_recruitment"], + "data": [], + "maintainers": ["ursais"], +} diff --git a/hr_employee_document_from_applicant/i18n/es_MX.po b/hr_employee_document_from_applicant/i18n/es_MX.po new file mode 100644 index 00000000000..33476bf865b --- /dev/null +++ b/hr_employee_document_from_applicant/i18n/es_MX.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_employee_document_from_applicant +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e-20230816\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-04-23 18:00+0000\n" +"PO-Revision-Date: 2024-04-23 18:00+0000\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_employee_document_from_applicant +#: model:ir.model,name:hr_employee_document_from_applicant.model_hr_employee +msgid "Employee" +msgstr "Empleado" diff --git a/hr_employee_document_from_applicant/i18n/hr_employee_document_from_applicant.pot b/hr_employee_document_from_applicant/i18n/hr_employee_document_from_applicant.pot new file mode 100644 index 00000000000..040465c1f99 --- /dev/null +++ b/hr_employee_document_from_applicant/i18n/hr_employee_document_from_applicant.pot @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_employee_document_from_applicant +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e-20230816\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-04-23 18:00+0000\n" +"PO-Revision-Date: 2024-04-23 18:00+0000\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_employee_document_from_applicant +#: model:ir.model,name:hr_employee_document_from_applicant.model_hr_employee +msgid "Employee" +msgstr "" diff --git a/hr_employee_document_from_applicant/models/__init__.py b/hr_employee_document_from_applicant/models/__init__.py new file mode 100644 index 00000000000..00fac6aa745 --- /dev/null +++ b/hr_employee_document_from_applicant/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2024 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import hr_employee diff --git a/hr_employee_document_from_applicant/models/hr_employee.py b/hr_employee_document_from_applicant/models/hr_employee.py new file mode 100644 index 00000000000..1f9621f61c5 --- /dev/null +++ b/hr_employee_document_from_applicant/models/hr_employee.py @@ -0,0 +1,30 @@ +# Copyright (C) 2024 Open Source Integrators (https://www.opensourceintegrators.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import api, models + + +class HrEmployee(models.Model): + _inherit = "hr.employee" + + @api.model_create_multi + def create(self, vals_list): + employees = super().create(vals_list) + for employee in employees: + if employee.applicant_id: + irAttachments = ( + self.env["ir.attachment"] + .sudo() + .search( + [ + ("res_model", "=", "hr.applicant"), + ("res_id", "=", employee.applicant_id.id), + ] + ) + ) + for attachment in irAttachments: + attachment.write( + {"res_model": "hr.employee", "res_id": employee.id} + ) + return employees diff --git a/hr_employee_document_from_applicant/readme/CONTRIBUTORS.rst b/hr_employee_document_from_applicant/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..374251a16c5 --- /dev/null +++ b/hr_employee_document_from_applicant/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Open Source Integrators `__ + + * Samuel Macias Oropeza + * Maxime Chambreuil diff --git a/hr_employee_document_from_applicant/readme/DESCRIPTION.rst b/hr_employee_document_from_applicant/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..4c7bef6761f --- /dev/null +++ b/hr_employee_document_from_applicant/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows you to move all the documents attached to a candidate to +the employee when the candidate is hired. diff --git a/hr_employee_document_from_applicant/readme/USAGE.rst b/hr_employee_document_from_applicant/readme/USAGE.rst new file mode 100644 index 00000000000..bf54a508956 --- /dev/null +++ b/hr_employee_document_from_applicant/readme/USAGE.rst @@ -0,0 +1,7 @@ +* Go to Recruitment +* Create a job position and a candidate +* Attach documents to the candidate +* Move the candidate through the recruitment process until the "Create +employee" button appears to click on it +* Go to the newly created employee: all the documents of the candidate are +available diff --git a/setup/hr_employee_document_from_applicant/odoo/addons/hr_employee_document_from_applicant b/setup/hr_employee_document_from_applicant/odoo/addons/hr_employee_document_from_applicant new file mode 120000 index 00000000000..015f363bff3 --- /dev/null +++ b/setup/hr_employee_document_from_applicant/odoo/addons/hr_employee_document_from_applicant @@ -0,0 +1 @@ +../../../../hr_employee_document_from_applicant \ No newline at end of file diff --git a/setup/hr_employee_document_from_applicant/setup.py b/setup/hr_employee_document_from_applicant/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/hr_employee_document_from_applicant/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)