From 65a35732d365bc7ec2177bbfe8ee1fddebc92244 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Thu, 27 Jun 2024 09:34:25 +0200 Subject: [PATCH] [IMP] hr_employee_departure_reason: pre-commit stuff --- hr_employee_departure_reason/README.rst | 6 ++-- hr_employee_departure_reason/__manifest__.py | 10 +++---- .../data/hr_employee_departure_reason.xml | 30 ++++++++++++++----- .../models/hr_employee_departure_reason.py | 8 ++--- .../test_hr_employee_departure_reason.py | 9 +++--- .../views/hr_employee_departure_reason.xml | 18 ++++++----- .../wizard/hr_departure_wizard.py | 15 +++++----- .../wizard/hr_departure_wizard_views.xml | 8 ++--- 8 files changed, 60 insertions(+), 44 deletions(-) diff --git a/hr_employee_departure_reason/README.rst b/hr_employee_departure_reason/README.rst index 2642387..c9795ed 100644 --- a/hr_employee_departure_reason/README.rst +++ b/hr_employee_departure_reason/README.rst @@ -2,9 +2,9 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -========================== -Hr employee departure reason -========================== +========================= +Employee departure reason +========================= * New object employee departure reason in employee. diff --git a/hr_employee_departure_reason/__manifest__.py b/hr_employee_departure_reason/__manifest__.py index d5fcc24..5caa49a 100644 --- a/hr_employee_departure_reason/__manifest__.py +++ b/hr_employee_departure_reason/__manifest__.py @@ -1,10 +1,10 @@ # Copyright 2021 Berezi - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - "name": "Hr Employee Departure Reason", - 'version': '14.0.1.0.0', + "name": "Employee departure reason", + "version": "14.0.1.0.0", "author": "Avanzosc", - "website": "https://www.avanzosc.es", + "website": "https://github.com/avanzosc/hr-addons", "category": "Human Resources/Employees", "depends": [ "hr", @@ -13,8 +13,8 @@ "security/ir.model.access.csv", "data/hr_employee_departure_reason.xml", "views/hr_employee_departure_reason.xml", - "wizard/hr_departure_wizard_views.xml" + "wizard/hr_departure_wizard_views.xml", ], "license": "AGPL-3", - 'installable': True, + "installable": True, } diff --git a/hr_employee_departure_reason/data/hr_employee_departure_reason.xml b/hr_employee_departure_reason/data/hr_employee_departure_reason.xml index 5d9d8af..2069bbd 100644 --- a/hr_employee_departure_reason/data/hr_employee_departure_reason.xml +++ b/hr_employee_departure_reason/data/hr_employee_departure_reason.xml @@ -1,16 +1,31 @@ - - - + + Contract Expiration Failed The Probationary Period - - Voluntary Resignation Within The Probationary Period + + Voluntary Resignation Within The Probationary Period - - Voluntary Resignation Outside The Probationary Period + + Voluntary Resignation Outside The Probationary Period Dismissed @@ -18,5 +33,4 @@ Other Reasons - diff --git a/hr_employee_departure_reason/models/hr_employee_departure_reason.py b/hr_employee_departure_reason/models/hr_employee_departure_reason.py index bbd7a3f..ed82e46 100644 --- a/hr_employee_departure_reason/models/hr_employee_departure_reason.py +++ b/hr_employee_departure_reason/models/hr_employee_departure_reason.py @@ -1,10 +1,10 @@ # Copyright 2021 Berezi - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import models, fields +from odoo import fields, models class HrEmployeeDepartureReason(models.Model): - _name = 'hr.employee.departure.reason' - _description = 'Employee Departure Reason' + _name = "hr.employee.departure.reason" + _description = "Employee Departure Reason" - name = fields.Char(string='Employee Departure Reason') + name = fields.Char(string="Employee Departure Reason") diff --git a/hr_employee_departure_reason/tests/test_hr_employee_departure_reason.py b/hr_employee_departure_reason/tests/test_hr_employee_departure_reason.py index a51c064..e3ed35e 100644 --- a/hr_employee_departure_reason/tests/test_hr_employee_departure_reason.py +++ b/hr_employee_departure_reason/tests/test_hr_employee_departure_reason.py @@ -1,20 +1,19 @@ # Copyright (c) 2021 Berezi Amubieta - Avanzosc S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests import common from odoo.exceptions import ValidationError +from odoo.tests import common class TestHrEmployeeDepartureReason(common.SavepointCase): @classmethod def setUpClass(cls): super(TestHrEmployeeDepartureReason, cls).setUpClass() - cls.wizard_obj = cls.env['hr.departure.wizard'] - cls.employee_obj = cls.env['hr.employee'] + cls.wizard_obj = cls.env["hr.departure.wizard"] + cls.employee_obj = cls.env["hr.employee"] cls.employee = cls.employee_obj.search([], limit=1) def test_hr_departure_wizard(self): - wizard = self.wizard_obj.with_context( - active_id=self.employee.id).create({}) + wizard = self.wizard_obj.with_context(active_id=self.employee.id).create({}) with self.assertRaises(ValidationError): wizard.action_register_departure() diff --git a/hr_employee_departure_reason/views/hr_employee_departure_reason.xml b/hr_employee_departure_reason/views/hr_employee_departure_reason.xml index a90f3f6..e332b2c 100644 --- a/hr_employee_departure_reason/views/hr_employee_departure_reason.xml +++ b/hr_employee_departure_reason/views/hr_employee_departure_reason.xml @@ -1,13 +1,12 @@ - - + hr.employee.departure.reason.tree hr.employee.departure.reason - - + + @@ -21,9 +20,12 @@ {} - + diff --git a/hr_employee_departure_reason/wizard/hr_departure_wizard.py b/hr_employee_departure_reason/wizard/hr_departure_wizard.py index 0ab260c..2031b79 100644 --- a/hr_employee_departure_reason/wizard/hr_departure_wizard.py +++ b/hr_employee_departure_reason/wizard/hr_departure_wizard.py @@ -1,21 +1,22 @@ # Copyright 2021 Berezi - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import fields, models, _ +from odoo import _, fields, models from odoo.exceptions import ValidationError class HrDepartureWizard(models.TransientModel): - _inherit = 'hr.departure.wizard' + _inherit = "hr.departure.wizard" departure_reason_id = fields.Many2one( - string='Employee Departure Reason', - comodel_name='hr.employee.departure.reason') - departure_observation = fields.Char( - string='Departure Observation') + string="Employee Departure Reason", + comodel_name="hr.employee.departure.reason", + ) + departure_observation = fields.Char(string="Departure Observation") def action_register_departure(self): result = super(HrDepartureWizard, self).action_register_departure() if not self.departure_reason_id: raise ValidationError( - _("You must introduce the employee departure reason.")) + _("You must introduce the employee departure reason.") + ) return result diff --git a/hr_employee_departure_reason/wizard/hr_departure_wizard_views.xml b/hr_employee_departure_reason/wizard/hr_departure_wizard_views.xml index 7d15d7c..5dccdeb 100644 --- a/hr_employee_departure_reason/wizard/hr_departure_wizard_views.xml +++ b/hr_employee_departure_reason/wizard/hr_departure_wizard_views.xml @@ -1,15 +1,15 @@ - + hr.departure.wizard - + 1 - - + +