-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] hr_employee_departure_reason: pre-commit stuff
- Loading branch information
Showing
8 changed files
with
60 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 22 additions & 8 deletions
30
hr_employee_departure_reason/data/hr_employee_departure_reason.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
<odoo> | ||
<data noupdate="1"> | ||
<record forcecreate="True" id="contract_expiration" model="hr.employee.departure.reason"> | ||
<odoo noupdate="1"> | ||
<record | ||
forcecreate="True" | ||
id="contract_expiration" | ||
model="hr.employee.departure.reason" | ||
> | ||
<field name="name">Contract Expiration</field> | ||
</record> | ||
<record forcecreate="True" id="not_passed" model="hr.employee.departure.reason"> | ||
<field name="name">Failed The Probationary Period</field> | ||
</record> | ||
<record forcecreate="True" id="resignation_within_period" model="hr.employee.departure.reason"> | ||
<field name="name">Voluntary Resignation Within The Probationary Period</field> | ||
<record | ||
forcecreate="True" | ||
id="resignation_within_period" | ||
model="hr.employee.departure.reason" | ||
> | ||
<field | ||
name="name" | ||
>Voluntary Resignation Within The Probationary Period</field> | ||
</record> | ||
<record forcecreate="True" id="resignation_outside_period" model="hr.employee.departure.reason"> | ||
<field name="name">Voluntary Resignation Outside The Probationary Period</field> | ||
<record | ||
forcecreate="True" | ||
id="resignation_outside_period" | ||
model="hr.employee.departure.reason" | ||
> | ||
<field | ||
name="name" | ||
>Voluntary Resignation Outside The Probationary Period</field> | ||
</record> | ||
<record forcecreate="True" id="dismissed" model="hr.employee.departure.reason"> | ||
<field name="name">Dismissed</field> | ||
</record> | ||
<record forcecreate="True" id="other" model="hr.employee.departure.reason"> | ||
<field name="name">Other Reasons</field> | ||
</record> | ||
</data> | ||
</odoo> |
8 changes: 4 additions & 4 deletions
8
hr_employee_departure_reason/models/hr_employee_departure_reason.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
9 changes: 4 additions & 5 deletions
9
hr_employee_departure_reason/tests/test_hr_employee_departure_reason.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
8 changes: 4 additions & 4 deletions
8
hr_employee_departure_reason/wizard/hr_departure_wizard_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters