Skip to content

Commit

Permalink
Merge e078c23 into f5aee45
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Jul 7, 2020
2 parents f5aee45 + e078c23 commit 774ffd8
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 30 deletions.
8 changes: 4 additions & 4 deletions hr_employee_join_termination_date/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Contributors
Maintainer
----------

.. image:: https://opensynergy-indonesia.com/logo.png
:alt: OpenSynergy Indonesia
:target: https://opensynergy-indonesia.com
.. image:: https://simetri-sinergi.id/logo.png
:alt: PT. Simetri Sinergi Indonesia
:target: https://simetri-sinergi.id.com

This module is maintained by the OpenSynergy Indonesia.
This module is maintained by the PT. Simetri Sinergi Indonesia.
6 changes: 4 additions & 2 deletions hr_employee_join_termination_date/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from . import(
models,
)
9 changes: 6 additions & 3 deletions hr_employee_join_termination_date/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Employee Join and Termination Date",
"version": "8.0.1.1.0",
"version": "8.0.1.2.0",
"category": "Human Resource",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"website": "https://simetri-sinergi.id",
"author": "Eficent, Odoo Community Association (OCA), "
"PT. Simetri Sinergi Indonesia, OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
Expand All @@ -20,6 +22,7 @@
],
},
"data": [
"data/ir_cron.xml",
"views/hr_employee_views.xml",
],
}
18 changes: 18 additions & 0 deletions hr_employee_join_termination_date/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">

<record id="cron_employee_longetivity_update" model="ir.cron">
<field name='name'>Update Employee Longetivity</field>
<field name='interval_number'>1</field>
<field name='interval_type'>days</field>
<field name="numbercall">-1</field>
<field name="active">False</field>
<field name="doall" eval="False" />
<field name="model">hr.employee</field>
<field name="function">cron_update_longetivity</field>
<field name="args">()</field>
</record>

</data>
</openerp>
6 changes: 4 additions & 2 deletions hr_employee_join_termination_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import hr_employee
from . import(
hr_employee,
)
49 changes: 30 additions & 19 deletions hr_employee_join_termination_date/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import api, models, fields
Expand All @@ -16,6 +17,23 @@
class HrEmployee(models.Model):
_inherit = "hr.employee"

date_join = fields.Date(
string="Join Date",
)
date_termination = fields.Date(
string="Termination Date",
)
year_work_longetivity = fields.Integer(
string="Year Work Longetivity",
compute="_compute_work_longetivity",
store=True,
)
month_work_longetivity = fields.Integer(
string="Month Work Longetivity",
compute="_compute_work_longetivity",
store=True,
)

@api.multi
@api.depends(
"date_join",
Expand All @@ -24,11 +42,15 @@ class HrEmployee(models.Model):
def _compute_work_longetivity(self):
for document in self:
year_work = month_work = 0
if document.date_join and document.date_termination:
if document.date_join:
if not document.date_termination:
dt_termination = \
pd.to_datetime(fields.Date.today())
else:
dt_termination =\
pd.to_datetime(document.date_termination)
dt_join =\
pd.to_datetime(document.date_join)
dt_termination =\
pd.to_datetime(document.date_termination)

dt_year_work = (dt_termination - dt_join)
year_work =\
Expand All @@ -42,19 +64,8 @@ def _compute_work_longetivity(self):
document.year_work_longetivity = year_work
document.month_work_longetivity = month_work

date_join = fields.Date(
string="Join Date",
)
date_termination = fields.Date(
string="Termination Date",
)
year_work_longetivity = fields.Integer(
string="Year Work Longetivity",
compute="_compute_work_longetivity",
store=True,
)
month_work_longetivity = fields.Integer(
string="Month Work Longetivity",
compute="_compute_work_longetivity",
store=True,
)
@api.model
def cron_update_longetivity(self):
employee_ids = self.search([])
for employee in employee_ids:
employee._compute_work_longetivity()
Binary file modified hr_employee_join_termination_date/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 OpenSynergy Indonesia
Copyright 2020 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
Expand Down

0 comments on commit 774ffd8

Please sign in to comment.