Skip to content

Commit

Permalink
[8.0.1.0.0] hr_timesheet_monkeypatch
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Aug 25, 2019
1 parent 01dcdaf commit 115eba1
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 0 deletions.
39 changes: 39 additions & 0 deletions hr_timesheet_monkeypatch/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=====================
Timesheet Monkeypatch
=====================


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 Monkeypatch*
6. Install the module

Credits
=======

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

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

Maintainer
----------

.. image:: https://opensynergy-indonesia.com/logo.png
:alt: OpenSynergy Indonesia
:target: https://opensynergy-indonesia.com

This module is maintained by the OpenSynergy Indonesia.
5 changes: 5 additions & 0 deletions hr_timesheet_monkeypatch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
19 changes: 19 additions & 0 deletions hr_timesheet_monkeypatch/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Timesheet Monkeypatch",
"version": "8.0.1.0.0",
"category": "Human Resource",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"hr_attendance_configuration_page",
"hr_timesheet_sheet",
],
"data": [
"views/hr_attendance_config_setting_views.xml",
],
}
25 changes: 25 additions & 0 deletions hr_timesheet_monkeypatch/hr_attendance_config_setting_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 OpenSynergy 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 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">
<data>
<xpath expr="//group[@name='general_configuration']/div" position="inside">
<div>
<field name="check_timesheet_equal_attendance" class="on_inline"/>
<label for="check_timesheet_equal_attendance"/>
</div>
</xpath>
</data>
</field>
</record>

</data>
</openerp>
9 changes: 9 additions & 0 deletions hr_timesheet_monkeypatch/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agplR.

from . import (
res_company,
res_config,
hr_timesheet_sheet,
)
21 changes: 21 additions & 0 deletions hr_timesheet_monkeypatch/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, api


class HrTimesheetSheet(models.Model):
_name = "hr_timesheet_sheet.sheet"
_inherit = "hr_timesheet_sheet.sheet"

@api.model
def check_employee_attendance_state(self, sheet_id):
_super = super(HrTimesheetSheet, self)
obj_ts = self.env["hr_timesheet_sheet.sheet"]
ts = obj_ts.browse([sheet_id])[0]
if ts.company_id.check_timesheet_equal_attendance:
result = _super.check_employee_attendance_state(sheet_id)
else:
result = True
return result
14 changes: 14 additions & 0 deletions hr_timesheet_monkeypatch/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields


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

check_timesheet_equal_attendance = fields.Boolean(
string="Check Equal Timesheet Attendance",
default=True,
)
14 changes: 14 additions & 0 deletions hr_timesheet_monkeypatch/models/res_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy 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"

check_timesheet_equal_attendance = fields.Boolean(
string="Check Equal Timesheet Attendance",
related="company_id.check_timesheet_equal_attendance",
)
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,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 OpenSynergy 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 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">
<data>
<xpath expr="//group[@name='general_configuration']/div" position="inside">
<div>
<field name="check_timesheet_equal_attendance" class="on_inline"/>
<label for="check_timesheet_equal_attendance"/>
</div>
</xpath>
</data>
</field>
</record>

</data>
</openerp>

0 comments on commit 115eba1

Please sign in to comment.