diff --git a/hr_personal_equipment_request/README.rst b/hr_personal_equipment_request/README.rst index 047ddbe9d70..84fcf94c825 100644 --- a/hr_personal_equipment_request/README.rst +++ b/hr_personal_equipment_request/README.rst @@ -17,18 +17,19 @@ Hr Personal Equipment Request :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_personal_equipment_request + :target: https://github.com/OCA/hr/tree/17.0/hr_personal_equipment_request :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_personal_equipment_request + :target: https://translation.odoo-community.org/projects/hr-17-0/hr-17-0-hr_personal_equipment_request :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 + :target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module allows to create a personal equipment request and manage allocation of employee personal equipment. +This module allows to create a personal equipment request and manage +allocation of employee personal equipment. **Table of contents** @@ -38,26 +39,32 @@ This module allows to create a personal equipment request and manage allocation Usage ===== -First, products which can be requested by employees should be marked as employee personal equipment. -1. Go to *Products* (In *Inventory* App for example). -2. Select a product. -3. Mark the *Is Employee Personal Equipment* flag.(An additional page appears which serves as a hook if additional fields are needed). - -To create a personal equipment request, a common user should follow the next steps: -1. Go to menu *Employees -> Personal Equipment-> Employee Personal Equipment Request* -2. Current employee is set as default. (An Hr Officer can change the employee if needed). -3. At *Personal Equipment* select the equipments you want to request. -4. Add "Observations" at *Observations* if desired. - -Then, an HR Manager should: -1. If everything is correct, "Accept" the request. -2. Finally, when the equipment is given to the employee, the allocation should be validated. This can be done in two ways: -a) Click the allocation in the equipment request that you want to validate, the form view will be opened, and click "Validate". -b) Go to *Employees -> Personal Equipment-> Allocations*. Select the corresponding allocation and click "Validate". - -A common user can only see its own allocations. The HR Officer can see all of them. - -If needed, the allocation can be expired clicking the button "Expire", which can be found at the allocation form view. +First, products which can be requested by employees should be marked as +employee personal equipment. 1. Go to *Products* (In *Inventory* App for +example). 2. Select a product. 3. Mark the *Is Employee Personal +Equipment* flag.(An additional page appears which serves as a hook if +additional fields are needed). + +To create a personal equipment request, a common user should follow the +next steps: 1. Go to menu *Employees -> Personal Equipment-> Employee +Personal Equipment Request* 2. Current employee is set as default. (An +Hr Officer can change the employee if needed). 3. At *Personal +Equipment* select the equipments you want to request. 4. Add +"Observations" at *Observations* if desired. + +Then, an HR Manager should: 1. If everything is correct, "Accept" the +request. 2. Finally, when the equipment is given to the employee, the +allocation should be validated. This can be done in two ways: a) Click +the allocation in the equipment request that you want to validate, the +form view will be opened, and click "Validate". b) Go to *Employees -> +Personal Equipment-> Allocations*. Select the corresponding allocation +and click "Validate". + +A common user can only see its own allocations. The HR Officer can see +all of them. + +If needed, the allocation can be expired clicking the button "Expire", +which can be found at the allocation form view. Bug Tracker =========== @@ -65,7 +72,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -73,17 +80,20 @@ Credits ======= Authors -~~~~~~~ +------- * Creu Blanca Contributors -~~~~~~~~~~~~ +------------ + +- Alba Riera +- `APSL `__: -* Alba Riera + - Antoni Marroig Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -95,6 +105,6 @@ 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 `_ project on GitHub. +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_personal_equipment_request/__manifest__.py b/hr_personal_equipment_request/__manifest__.py index a4970db6498..bea18192da9 100644 --- a/hr_personal_equipment_request/__manifest__.py +++ b/hr_personal_equipment_request/__manifest__.py @@ -5,7 +5,7 @@ "name": "Hr Personal Equipment Request", "summary": """ This addon allows to manage employee personal equipment""", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca, Odoo Community Association (OCA)", "website": "https://github.com/OCA/hr", diff --git a/hr_personal_equipment_request/models/hr_employee.py b/hr_personal_equipment_request/models/hr_employee.py index f7d2aea553e..712d52dac67 100644 --- a/hr_personal_equipment_request/models/hr_employee.py +++ b/hr_personal_equipment_request/models/hr_employee.py @@ -5,7 +5,6 @@ class HrEmployee(models.Model): - _inherit = "hr.employee" equipment_request_ids = fields.One2many( diff --git a/hr_personal_equipment_request/models/hr_personal_equipment.py b/hr_personal_equipment_request/models/hr_personal_equipment.py index cba888e2b2f..93b2257185f 100644 --- a/hr_personal_equipment_request/models/hr_personal_equipment.py +++ b/hr_personal_equipment_request/models/hr_personal_equipment.py @@ -6,7 +6,6 @@ class HrPersonalEquipment(models.Model): - _name = "hr.personal.equipment" _description = "Adds personal equipment information and allocation" _inherit = ["mail.thread", "mail.activity.mixin"] @@ -57,7 +56,7 @@ def _onchange_uom_id(self): def _compute_name(self): for rec in self: if rec.product_id.name and rec.employee_id.name: - rec.name = "{} to {}".format(rec.product_id.name, rec.employee_id.name) + rec.name = f"{rec.product_id.name} to {rec.employee_id.name}" else: rec.name = False diff --git a/hr_personal_equipment_request/models/hr_personal_equipment_request.py b/hr_personal_equipment_request/models/hr_personal_equipment_request.py index 41c808c4653..e3eb5347e9f 100644 --- a/hr_personal_equipment_request/models/hr_personal_equipment_request.py +++ b/hr_personal_equipment_request/models/hr_personal_equipment_request.py @@ -5,7 +5,6 @@ class HrPersonalEquipmentRequest(models.Model): - _name = "hr.personal.equipment.request" _description = "This model allows to create a personal equipment request" _inherit = ["mail.thread", "mail.activity.mixin"] diff --git a/hr_personal_equipment_request/models/product_template.py b/hr_personal_equipment_request/models/product_template.py index ecd779d65e3..c6a4f1566c8 100644 --- a/hr_personal_equipment_request/models/product_template.py +++ b/hr_personal_equipment_request/models/product_template.py @@ -5,7 +5,6 @@ class ProductTemplate(models.Model): - _inherit = "product.template" is_personal_equipment = fields.Boolean( diff --git a/hr_personal_equipment_request/pyproject.toml b/hr_personal_equipment_request/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/hr_personal_equipment_request/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/hr_personal_equipment_request/readme/CONTRIBUTORS.md b/hr_personal_equipment_request/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..111e484c51f --- /dev/null +++ b/hr_personal_equipment_request/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Alba Riera \<\> +- [APSL](https://apsl.tech): + - Antoni Marroig \<\> \ No newline at end of file diff --git a/hr_personal_equipment_request/readme/CONTRIBUTORS.rst b/hr_personal_equipment_request/readme/CONTRIBUTORS.rst deleted file mode 100644 index c5fbe36d180..00000000000 --- a/hr_personal_equipment_request/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1 +0,0 @@ -* Alba Riera diff --git a/hr_personal_equipment_request/readme/DESCRIPTION.rst b/hr_personal_equipment_request/readme/DESCRIPTION.md similarity index 57% rename from hr_personal_equipment_request/readme/DESCRIPTION.rst rename to hr_personal_equipment_request/readme/DESCRIPTION.md index 748a64195dd..aaf0a2da85f 100644 --- a/hr_personal_equipment_request/readme/DESCRIPTION.rst +++ b/hr_personal_equipment_request/readme/DESCRIPTION.md @@ -1 +1,2 @@ -This module allows to create a personal equipment request and manage allocation of employee personal equipment. +This module allows to create a personal equipment request and manage +allocation of employee personal equipment. diff --git a/hr_personal_equipment_request/readme/USAGE.md b/hr_personal_equipment_request/readme/USAGE.md new file mode 100644 index 00000000000..1d9f1f9befe --- /dev/null +++ b/hr_personal_equipment_request/readme/USAGE.md @@ -0,0 +1,26 @@ +First, products which can be requested by employees should be marked as +employee personal equipment. 1. Go to *Products* (In *Inventory* App for +example). 2. Select a product. 3. Mark the *Is Employee Personal +Equipment* flag.(An additional page appears which serves as a hook if +additional fields are needed). + +To create a personal equipment request, a common user should follow the +next steps: 1. Go to menu *Employees -\> Personal Equipment-\> Employee +Personal Equipment Request* 2. Current employee is set as default. (An +Hr Officer can change the employee if needed). 3. At *Personal +Equipment* select the equipments you want to request. 4. Add +"Observations" at *Observations* if desired. + +Then, an HR Manager should: 1. If everything is correct, "Accept" the +request. 2. Finally, when the equipment is given to the employee, the +allocation should be validated. This can be done in two ways: a) Click +the allocation in the equipment request that you want to validate, the +form view will be opened, and click "Validate". b) Go to *Employees -\> +Personal Equipment-\> Allocations*. Select the corresponding allocation +and click "Validate". + +A common user can only see its own allocations. The HR Officer can see +all of them. + +If needed, the allocation can be expired clicking the button "Expire", +which can be found at the allocation form view. diff --git a/hr_personal_equipment_request/readme/USAGE.rst b/hr_personal_equipment_request/readme/USAGE.rst deleted file mode 100644 index 08340d5dbf1..00000000000 --- a/hr_personal_equipment_request/readme/USAGE.rst +++ /dev/null @@ -1,20 +0,0 @@ -First, products which can be requested by employees should be marked as employee personal equipment. -1. Go to *Products* (In *Inventory* App for example). -2. Select a product. -3. Mark the *Is Employee Personal Equipment* flag.(An additional page appears which serves as a hook if additional fields are needed). - -To create a personal equipment request, a common user should follow the next steps: -1. Go to menu *Employees -> Personal Equipment-> Employee Personal Equipment Request* -2. Current employee is set as default. (An Hr Officer can change the employee if needed). -3. At *Personal Equipment* select the equipments you want to request. -4. Add "Observations" at *Observations* if desired. - -Then, an HR Manager should: -1. If everything is correct, "Accept" the request. -2. Finally, when the equipment is given to the employee, the allocation should be validated. This can be done in two ways: -a) Click the allocation in the equipment request that you want to validate, the form view will be opened, and click "Validate". -b) Go to *Employees -> Personal Equipment-> Allocations*. Select the corresponding allocation and click "Validate". - -A common user can only see its own allocations. The HR Officer can see all of them. - -If needed, the allocation can be expired clicking the button "Expire", which can be found at the allocation form view. diff --git a/hr_personal_equipment_request/static/description/index.html b/hr_personal_equipment_request/static/description/index.html index b24d1909a40..7b03e92886d 100644 --- a/hr_personal_equipment_request/static/description/index.html +++ b/hr_personal_equipment_request/static/description/index.html @@ -369,8 +369,9 @@

Hr Personal Equipment Request

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:c2e4d816b2325ecac17625c9c563499d3f1a0a7d48f16690ecbed0c1bcf3ccf8 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

-

This module allows to create a personal equipment request and manage allocation of employee personal equipment.

+

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

+

This module allows to create a personal equipment request and manage +allocation of employee personal equipment.

Table of contents

    @@ -386,29 +387,35 @@

    Hr Personal Equipment Request

Usage

-

First, products which can be requested by employees should be marked as employee personal equipment. -1. Go to Products (In Inventory App for example). -2. Select a product. -3. Mark the Is Employee Personal Equipment flag.(An additional page appears which serves as a hook if additional fields are needed).

-

To create a personal equipment request, a common user should follow the next steps: -1. Go to menu Employees -> Personal Equipment-> Employee Personal Equipment Request -2. Current employee is set as default. (An Hr Officer can change the employee if needed). -3. At Personal Equipment select the equipments you want to request. -4. Add “Observations” at Observations if desired.

-

Then, an HR Manager should: -1. If everything is correct, “Accept” the request. -2. Finally, when the equipment is given to the employee, the allocation should be validated. This can be done in two ways: -a) Click the allocation in the equipment request that you want to validate, the form view will be opened, and click “Validate”. -b) Go to Employees -> Personal Equipment-> Allocations. Select the corresponding allocation and click “Validate”.

-

A common user can only see its own allocations. The HR Officer can see all of them.

-

If needed, the allocation can be expired clicking the button “Expire”, which can be found at the allocation form view.

+

First, products which can be requested by employees should be marked as +employee personal equipment. 1. Go to Products (In Inventory App for +example). 2. Select a product. 3. Mark the Is Employee Personal +Equipment flag.(An additional page appears which serves as a hook if +additional fields are needed).

+

To create a personal equipment request, a common user should follow the +next steps: 1. Go to menu Employees -> Personal Equipment-> Employee +Personal Equipment Request 2. Current employee is set as default. (An +Hr Officer can change the employee if needed). 3. At Personal +Equipment select the equipments you want to request. 4. Add +“Observations” at Observations if desired.

+

Then, an HR Manager should: 1. If everything is correct, “Accept” the +request. 2. Finally, when the equipment is given to the employee, the +allocation should be validated. This can be done in two ways: a) Click +the allocation in the equipment request that you want to validate, the +form view will be opened, and click “Validate”. b) Go to Employees -> +Personal Equipment-> Allocations. Select the corresponding allocation +and click “Validate”.

+

A common user can only see its own allocations. The HR Officer can see +all of them.

+

If needed, the allocation can be expired clicking the button “Expire”, +which can be found at the allocation form view.

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.

+feedback.

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

@@ -423,6 +430,10 @@

Authors

Contributors

@@ -432,7 +443,7 @@

Maintainers

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

+

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_personal_equipment_request/tests/test_hr_personal_equipment_request.py b/hr_personal_equipment_request/tests/test_hr_personal_equipment_request.py index 0ee6ccf0481..ab91c3c9ba9 100644 --- a/hr_personal_equipment_request/tests/test_hr_personal_equipment_request.py +++ b/hr_personal_equipment_request/tests/test_hr_personal_equipment_request.py @@ -1,28 +1,30 @@ # Copyright 2021 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import _ from odoo.tests import TransactionCase class TestHRPersonalEquipmentRequest(TransactionCase): - def setUp(self): - super().setUp() - self.product_personal_equipment_1 = self.env["product.template"].create( + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product_personal_equipment_1 = cls.env["product.template"].create( { "name": "Product Test Personal Equipment 1", "is_personal_equipment": True, - "uom_id": self.env.ref("uom.product_uom_unit").id, + "uom_id": cls.env.ref("uom.product_uom_unit").id, } ) - self.product_personal_equipment_2 = self.env["product.template"].create( + cls.product_personal_equipment_2 = cls.env["product.template"].create( { "name": "Product Test Personal Equipment 2", "is_personal_equipment": True, - "uom_id": self.env.ref("uom.product_uom_unit").id, + "uom_id": cls.env.ref("uom.product_uom_unit").id, } ) - self.user = ( - self.env["res.users"] + cls.user = ( + cls.env["res.users"] .sudo() .create( { @@ -30,36 +32,36 @@ def setUp(self): "login": "user@test.com", "email": "user@test.com", "groups_id": [ - (4, self.env.ref("base.group_user").id), - (4, self.env.ref("hr.group_hr_user").id), + (4, cls.env.ref("base.group_user").id), + (4, cls.env.ref("hr.group_hr_user").id), ], } ) ) - self.employee = self.env["hr.employee"].create( - {"name": "Employee Test", "user_id": self.user.id} + cls.employee = cls.env["hr.employee"].create( + {"name": "Employee Test", "user_id": cls.user.id} ) lines = [ { "name": "Personal Equipment 1", - "product_id": self.product_personal_equipment_1.product_variant_id.id, + "product_id": cls.product_personal_equipment_1.product_variant_id.id, "quantity": 3, }, { "name": "Personal Equipment 2", - "product_id": self.product_personal_equipment_2.product_variant_id.id, + "product_id": cls.product_personal_equipment_2.product_variant_id.id, "quantity": 2, }, ] - self.personal_equipment_request = ( - self.env["hr.personal.equipment.request"] - .with_user(self.user.id) + cls.personal_equipment_request = ( + cls.env["hr.personal.equipment.request"] + .with_user(cls.user.id) .create( { "name": "Personal Equipment Request Test", - "employee_id": self.employee.id, + "employee_id": cls.employee.id, "line_ids": [(0, 0, line) for line in lines], } ) @@ -69,7 +71,7 @@ def test_request_compute_name(self): self.assertTrue(self.personal_equipment_request.name) self.assertEqual( self.personal_equipment_request.name, - "Personal Equipment Request by Employee Test", + _("Personal Equipment Request by %s") % "Employee Test", ) def test_request_default_employee(self): diff --git a/hr_personal_equipment_request/views/hr_employee_views.xml b/hr_personal_equipment_request/views/hr_employee_views.xml index 4b96bfe9368..0b51ca0ac6d 100644 --- a/hr_personal_equipment_request/views/hr_employee_views.xml +++ b/hr_personal_equipment_request/views/hr_employee_views.xml @@ -12,7 +12,7 @@ name="action_open_equipment_request" type="object" icon="fa-hand-o-up" - attrs="{'invisible': [('equipment_request_count', '=', 0)]}" + invisible="equipment_request_count == 0" >