Skip to content

Commit

Permalink
[MIG] hr_employee_age: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Vang-NguyenPhu committed Dec 20, 2024
1 parent 40c0909 commit 0cabf36
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 45 deletions.
34 changes: 19 additions & 15 deletions hr_employee_age/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Employee Age
: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_age
:target: https://github.com/OCA/hr/tree/17.0/hr_employee_age
: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_age
:target: https://translation.odoo-community.org/projects/hr-17-0/hr-17-0-hr_employee_age
: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|
Expand All @@ -38,40 +38,44 @@ Adds and computes age field on employee
Usage
=====

When you add the birthday of an employee, the age of an employee will auto-populate.
When you add the birthday of an employee, the age of an employee will
auto-populate.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr/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 <https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_age%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_age%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~
-------

* Salton Massally <smassally@idtlabs.sl>

Contributors
~~~~~~~~~~~~
------------

* Salton Massally (iDT Labs) <smassally@idtlabs.sl>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Saran Lim. <saranl@ecosoft.co.th>
* Komsan Somwong <komsans@ecosoft.co.th>
- Salton Massally (iDT Labs) <smassally@idtlabs.sl>
- Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
- Saran Lim. <saranl@ecosoft.co.th>
- Komsan Somwong <komsans@ecosoft.co.th>
- `Pesol <https://www.pesol.es>`__:

* `Pesol <https://www.pesol.es>`__:
- Pedro Evaristo Gonzalez Sanchez <pedro.gonzalez@pesol.es>

* Pedro Evaristo Gonzalez Sanchez <pedro.gonzalez@pesol.es>
- `Komit <https://komit-consulting.com>`__:

- Vang Nguyen Phu

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -83,6 +87,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 <https://github.com/OCA/hr/tree/16.0/hr_employee_age>`_ project on GitHub.
This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/17.0/hr_employee_age>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion hr_employee_age/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Employee Age",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "Salton Massally <smassally@idtlabs.sl>, "
"Odoo Community Association (OCA)",
Expand Down
6 changes: 1 addition & 5 deletions hr_employee_age/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (C) 2015 Salton Massally (<smassally@idtlabs.sl>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from dateutil.relativedelta import relativedelta

from odoo import api, fields, models

Expand All @@ -17,7 +16,4 @@ class HrEmployee(models.Model):
@api.depends("birthday")
def _compute_age(self):
for record in self:
age = 0
if record.birthday:
age = relativedelta(fields.Date.today(), record.birthday).years
record.age = age
record.age = record._get_age()
3 changes: 3 additions & 0 deletions hr_employee_age/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
8 changes: 8 additions & 0 deletions hr_employee_age/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- Salton Massally (iDT Labs) \<<smassally@idtlabs.sl>\>
- Serpent Consulting Services Pvt. Ltd. \<<support@serpentcs.com>\>
- Saran Lim. \<<saranl@ecosoft.co.th>\>
- Komsan Somwong \<<komsans@ecosoft.co.th>\>
- [Pesol](https://www.pesol.es):
- Pedro Evaristo Gonzalez Sanchez \<<pedro.gonzalez@pesol.es>\>
- [Komit](https://komit-consulting.com):
- Vang Nguyen Phu
8 changes: 0 additions & 8 deletions hr_employee_age/readme/CONTRIBUTORS.rst

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
When you add the birthday of an employee, the age of an employee will auto-populate.
When you add the birthday of an employee, the age of an employee will
auto-populate.
25 changes: 16 additions & 9 deletions hr_employee_age/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Employee Age</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:562bc7a14c6494d67ecdc257acf134c6dc0f21e46d975385817660a0906c798c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr/tree/16.0/hr_employee_age"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_employee_age"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr/tree/17.0/hr_employee_age"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-17-0/hr-17-0-hr_employee_age"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Adds and computes age field on employee</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -386,14 +386,15 @@ <h1 class="title">Employee Age</h1>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>When you add the birthday of an employee, the age of an employee will auto-populate.</p>
<p>When you add the birthday of an employee, the age of an employee will
auto-populate.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/hr/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_age%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_age%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -415,16 +416,22 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Pedro Evaristo Gonzalez Sanchez &lt;<a class="reference external" href="mailto:pedro.gonzalez&#64;pesol.es">pedro.gonzalez&#64;pesol.es</a>&gt;</li>
</ul>
</li>
<li><a class="reference external" href="https://komit-consulting.com">Komit</a>:<ul>
<li>Vang Nguyen Phu</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr/tree/16.0/hr_employee_age">OCA/hr</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr/tree/17.0/hr_employee_age">OCA/hr</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
14 changes: 8 additions & 6 deletions hr_employee_age/tests/test_hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
from dateutil.relativedelta import relativedelta

from odoo import fields
from odoo.tests import common

from odoo.addons.base.tests.common import BaseCommon

class TestHrEmployee(common.TransactionCase):
def setUp(self):
super().setUp()
self.employee_admin = self.env.ref("hr.employee_admin")
self.employee_admin.write({"birthday": "1990-05-15"})

class TestHrEmployee(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.employee_admin = cls.env.ref("hr.employee_admin")
cls.employee_admin.write({"birthday": "1990-05-15"})

def test_compute_age(self):
self.employee_admin._compute_age()
Expand Down

0 comments on commit 0cabf36

Please sign in to comment.