Skip to content

Commit

Permalink
[8.0.1.0.0][hr_timesheet_sheet_sequence_configurator]
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Oct 20, 2020
1 parent 92ebf80 commit 5e034ae
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 0 deletions.
43 changes: 43 additions & 0 deletions hr_timesheet_sheet_sequence_configurator/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
=====================================
Timesheet Sheet 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_timesheet_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 *Timesheet Sheet 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_timesheet_sheet_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,
)
26 changes: 26 additions & 0 deletions hr_timesheet_sheet_sequence_configurator/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- 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": "Timesheet Sheet 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_timesheet_sheet",
"base_sequence_configurator",
],
"data": [
"data/ir_sequence_data.xml",
"data/base_sequence_configurator_data.xml",
"views/hr_attendance_config_setting_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_timesheet_sheet" model="base.sequence_configurator">
<field name="model_id" ref="hr_timesheet_sheet.model_hr_timesheet_sheet_sheet"/>
<field name="sequence_field_id" search="[('model_id.model','=','hr_timesheet_sheet.sheet'),('name','=','name')]"/>
<field name="fallback_sequence_id" ref="hr_timesheet_sheet_sequence_configurator.sequence_hr_timesheet_sheet"/>
</record>

<record id="base_sequence_hr_timesheet_sheet_line" model="base.sequence_configurator_line">
<field name="generator_id" ref="base_sequence_hr_timesheet_sheet"/>
<field name="sequence" eval="1"/>
<field name="sequence_computation_code">result = document.company_id.timesheet_sheet_sequence_id</field>
</record>
</data>
</openerp>
25 changes: 25 additions & 0 deletions hr_timesheet_sheet_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_timesheet_sheet" model="ir.sequence.type">
<field name="name">Timesheet</field>
<field name="code">hr_timesheet_sheet.sheet</field>
</record>

</data>

<data noupdate="1">
<record id="sequence_hr_timesheet_sheet" model="ir.sequence">
<field name="name">Timeseet</field>
<field name="code">hr_timesheet_sheet.sheet</field>
<field name="padding">5</field>
<field name="prefix">TIMESHEET/%(year)s/</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
</data>
</openerp>
9 changes: 9 additions & 0 deletions hr_timesheet_sheet_sequence_configurator/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- 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_timesheet_sheet_sheet,
res_company,
res_config,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- 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 openerp import models, api, fields


class HrTimesheetSheetSheet(models.Model):
_name = "hr_timesheet_sheet.sheet"
_inherit = [
"hr_timesheet_sheet.sheet",
"base.sequence_document",
]

name = fields.Char(
default="/",
copy=False,
)

@api.model
def create(self, values):
_super = super(HrTimesheetSheetSheet, self)
result = _super.create(values)
sequence = result._create_sequence()
result.write({
"name": sequence,
})
return result

@api.multi
def name_get(self):
_super = super(HrTimesheetSheetSheet, self)
res = _super.name_get()
result = []
for rec in self:
if rec.name:
result.append((rec.id, rec.name))
else:
result = res
return result
14 changes: 14 additions & 0 deletions hr_timesheet_sheet_sequence_configurator/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- 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 openerp import models, fields, api


class ResCompany(models.Model):
_inherit = "res.company"

timesheet_sheet_sequence_id = fields.Many2one(
string="Timesheet Sheet Sequence",
comodel_name="ir.sequence",
)
16 changes: 16 additions & 0 deletions hr_timesheet_sheet_sequence_configurator/models/res_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- 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 openerp import models, fields


class ResConfig(models.TransientModel):
_inherit = "hr.attendance_config_setting"

timesheet_sheet_sequence_id = fields.Many2one(
string="Timesheet Sheet Sequence",
comodel_name="ir.sequence",
related="company_id.timesheet_sheet_sequence_id",
store=False,
)
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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_attendance_config_setting_view_form" model="ir.ui.view">
<field name="name">hr.attendance_config_setting.sequence.form</field>
<field name="model">hr.attendance_config_setting</field>
<field name="inherit_id" ref="hr_attendance_configuration_page.hr_attendance_config_setting_view_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='general_configuration']" position="after">
<div>
<label for="id" string="Timesheet Sheet Sequence" class="oe_inline"/>
<field name="timesheet_sheet_sequence_id" class="oe_inline"/>
</div>
</xpath>
</field>
</record>
</data>
</openerp>

0 comments on commit 5e034ae

Please sign in to comment.