Skip to content

Commit

Permalink
[8.0.1.0.0][hr_employee_sequence_configurator]
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 authored and andhit-r committed Oct 19, 2020
1 parent 9b786f1 commit 00548b2
Show file tree
Hide file tree
Showing 12 changed files with 222 additions and 0 deletions.
43 changes: 43 additions & 0 deletions hr_employee_sequence_configurator/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
==============================
Employee Sequence Configurator
==============================

.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-open--synergy%2Fopnsynid--hr-lightgray.png?logo=github
:target: https://github.com/open-synergy/opnsynid-hr/tree/8.0/hr_employee_sequence_configurator
:alt: open-synergy/opnsynid-hr

|badge2| |badge3|


Installation
============

To install this module, you need to:

1. Clone the branch 8.0 of the repository https://github.com/open-synergy/opnsynid-hr
2. Add the path to this repository in your configuration (addons-path)
3. Update the module list
4. Go to menu *Setting -> Modules -> Local Modules*
5. Search For *Employee Sequence Configurator*
6. Install the module

Credits
=======

Contributors
------------

* Michael Viriyananda <viriyananda.michael@gmail.com>
* Andhitia Rama <andhitia.r@gmail.com>

Maintainer
----------

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

This module is maintained by the PT. Simetri Sinergi Indonesia.
7 changes: 7 additions & 0 deletions hr_employee_sequence_configurator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2020 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import (
models,
)
27 changes: 27 additions & 0 deletions hr_employee_sequence_configurator/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2020 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 Sequence Configurator",
"version": "8.0.1.0.0",
"category": "Human Resource",
"website": "https://simetri-sinergi.id",
"author": "OpenSynergy Indonesia, PT. Simetri Sinergi Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"hr_employee_employment_status",
"base_sequence_configurator",
],
"data": [
"data/ir_sequence_data.xml",
"data/base_sequence_configurator_data.xml",
"views/hr_employment_status_views.xml",
"views/hr_employee_views.xml",
],
"images": [
"static/description/banner.png",
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 OpenSynergy Indonesia
Copyright 2020 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>
<record id="base_sequence_hr_employee" model="base.sequence_configurator">
<field name="model_id" ref="hr.model_hr_employee"/>
<field name="sequence_field_id" search="[('model_id.model','=','hr.employee'),('name','=','employee_code')]"/>
<field name="fallback_sequence_id" ref="hr_employee_sequence_configurator.sequence_hr_employee"/>
</record>

<record id="base_sequence_hr_employee_line" model="base.sequence_configurator_line">
<field name="generator_id" ref="base_sequence_hr_employee"/>
<field name="sequence" eval="1"/>
<field name="sequence_computation_code">result = document.employment_status_id.sequence_id</field>
</record>
</data>
</openerp>
25 changes: 25 additions & 0 deletions hr_employee_sequence_configurator/data/ir_sequence_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!-- Copyright 2020 OpenSynergy Indonesia
Copyright 2020 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp>
<data>

<record id="seq_type_hr_employee" model="ir.sequence.type">
<field name="name">Employee</field>
<field name="code">hr.employee</field>
</record>

</data>

<data noupdate="1">
<record id="sequence_hr_employee" model="ir.sequence">
<field name="name">Employee</field>
<field name="code">hr.employee</field>
<field name="padding">5</field>
<field name="prefix">EMP/%(year)s/</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
</data>
</openerp>
8 changes: 8 additions & 0 deletions hr_employee_sequence_configurator/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2020 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import (
hr_employment_status,
hr_employee,
)
34 changes: 34 additions & 0 deletions hr_employee_sequence_configurator/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Copyright 2020 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api


class HrEmployee(models.Model):
_name = "hr.employee"
_inherit = [
"hr.employee",
"base.sequence_document",
]

employee_code = fields.Char(
string="Employee Code",
default="/",
required=True,
copy=False,
)

@api.multi
def action_create_identification_id(self):
for document in self:
document._create_identification_id()

@api.multi
def _create_identification_id(self):
self.ensure_one()
sequence = self._create_sequence()
self.write({
"employee_code": sequence,
})
15 changes: 15 additions & 0 deletions hr_employee_sequence_configurator/models/hr_employment_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields


class HrEmploymentStatus(models.Model):
_inherit = "hr.employment_status"

sequence_id = fields.Many2one(
string="Sequence",
comodel_name="ir.sequence",
company_dependent=True,
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions hr_employee_sequence_configurator/views/hr_employee_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 OpenSynergy Indonesia
Copyright 2020 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<record id="hr_employee_view_form" model="ir.ui.view">
<field name="name">hr.employee form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='identification_id']" position="after">
<field name="employee_code"/>
<button name="action_create_identification_id" string="Generate ID" type="object" colspan="2"/>
</xpath>
</data>
</field>
</record>

</data>
</openerp>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 OpenSynergy Indonesia
Copyright 2020 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->

<openerp>
<data>
<record id="hr_employment_status_view_form" model="ir.ui.view">
<field name="name">hr.employment.status.form</field>
<field name="model">hr.employment_status</field>
<field name="inherit_id" ref="hr_employee_employment_status.hr_employment_status_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='code']" position="after">
<field name="sequence_id"/>
</xpath>
</field>
</record>
</data>
</openerp>

0 comments on commit 00548b2

Please sign in to comment.