Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0.4.0.0][hr_timesheet_attendance_schedule] #234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hr_timesheet_attendance_schedule/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,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_timesheet_attendance_schedule/__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,
)
11 changes: 8 additions & 3 deletions hr_timesheet_attendance_schedule/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2018-2019 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 Attendance Schedule",
"version": "8.0.3.3.0",
"version": "8.0.4.0.0",
"category": "Human Resource",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"website": "https://simetri-sinergi.id",
"author": "PT. Simetri Sinergi Indonesia, OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
Expand All @@ -16,6 +17,7 @@
"base_sequence_configurator",
"base_workflow_policy",
"web_readonly_bypass",
"base_multiple_approval",
],
"data": [
"security/ir.model.access.csv",
Expand All @@ -31,4 +33,7 @@
"views/hr_timesheet_attendance_schedule_change_views.xml",
"views/hr_attendance_config_setting_views.xml",
],
"images": [
"static/description/banner.png",
],
}
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 OpenSynergy Indonesia
Copyright 2020 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

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

<openerp>
Expand All @@ -8,26 +9,26 @@
<record id="base_workflow_attendance_schedule_change" model="base.workflow_policy">
<field name="model_id" ref="hr_timesheet_attendance_schedule.model_hr_timesheet_attendance_schedule_change"/>
</record>
<record id="base_workflow_line_loan_in_confirm" model="base.workflow_policy_line">
<record id="base_workflow_line_attendance_schedule_change_confirm" model="base.workflow_policy_line">
<field name="workflow_id" ref="hr_timesheet_attendance_schedule.base_workflow_attendance_schedule_change"/>
<field name="field_id" search="[('model_id.model','=','hr.timesheet_attendance_schedule_change'),('name','=','confirm_ok')]"/>
<field name="python_code">result = document.company_id.schedule_change_confirm_grp_ids.ids</field>
</record>
<record id="base_workflow_line_loan_in_valid" model="base.workflow_policy_line">
<field name="workflow_id" ref="hr_timesheet_attendance_schedule.base_workflow_attendance_schedule_change"/>
<field name="field_id" search="[('model_id.model','=','hr.timesheet_attendance_schedule_change'),('name','=','valid_ok')]"/>
<field name="python_code">result = document.company_id.schedule_change_valid_grp_ids.ids</field>
</record>
<record id="base_workflow_line_loan_in_cancel" model="base.workflow_policy_line">
<record id="base_workflow_line_attendance_schedule_change_cancel" model="base.workflow_policy_line">
<field name="workflow_id" ref="hr_timesheet_attendance_schedule.base_workflow_attendance_schedule_change"/>
<field name="field_id" search="[('model_id.model','=','hr.timesheet_attendance_schedule_change'),('name','=','cancel_ok')]"/>
<field name="python_code">result = document.company_id.schedule_change_cancel_grp_ids.ids</field>
</record>
<record id="base_workflow_line_loan_in_restart" model="base.workflow_policy_line">
<record id="base_workflow_line_attendance_schedule_change_restart" model="base.workflow_policy_line">
<field name="workflow_id" ref="hr_timesheet_attendance_schedule.base_workflow_attendance_schedule_change"/>
<field name="field_id" search="[('model_id.model','=','hr.timesheet_attendance_schedule_change'),('name','=','restart_ok')]"/>
<field name="python_code">result = document.company_id.schedule_change_restart_grp_ids.ids</field>
</record>
<record id="base_workflow_line_attendance_schedule_change_restart_val" model="base.workflow_policy_line">
<field name="workflow_id" ref="hr_timesheet_attendance_schedule.base_workflow_attendance_schedule_change"/>
<field name="field_id" search="[('model_id.model','=','hr.timesheet_attendance_schedule_change'),('name','=','restart_approval_ok')]"/>
<field name="python_code">result = document.company_id.schedule_change_restart_val_grp_ids.ids</field>
</record>

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

<openerp>
Expand Down
1 change: 1 addition & 0 deletions hr_timesheet_attendance_schedule/data/ir_filters_data.xml
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
4 changes: 4 additions & 0 deletions hr_timesheet_attendance_schedule/data/ir_sequence_data.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0"?>
<!-- Copyright 2018 OpenSynergy Indonesia
Copyright 2020 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data noupdate="1">

Expand Down
3 changes: 2 additions & 1 deletion hr_timesheet_attendance_schedule/data/ir_values_data.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018-2019 OpenSynergy Indonesia
<!-- 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
17 changes: 10 additions & 7 deletions hr_timesheet_attendance_schedule/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# -*- 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_attendance
from . import hr_timesheet_attendance_schedule
from . import hr_timesheet_sheet
from . import res_company
from . import res_config
from . import hr_timesheet_attendance_schedule_change
from . import (
hr_attendance,
hr_timesheet_attendance_schedule,
hr_timesheet_sheet,
res_company,
res_config,
hr_timesheet_attendance_schedule_change,
tier_definition,
)
1 change: 1 addition & 0 deletions hr_timesheet_attendance_schedule/models/hr_attendance.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).

from dateutil.relativedelta import relativedelta
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2019 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
Expand Down
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).

from openerp import models, fields, api, _
Expand All @@ -13,6 +14,14 @@ class HrTimesheetAttendanceScheduleChange(models.Model):
"mail.thread",
"base.sequence_document",
"base.workflow_policy_object",
"tier.validation",
]
_state_from = [
"draft",
"confirm",
]
_state_to = [
"valid",
]

@api.model
Expand Down Expand Up @@ -155,10 +164,6 @@ def _compute_policy(self):
string="Can Confirm",
compute="_compute_policy",
)
valid_ok = fields.Boolean(
string="Can Finish",
compute="_compute_policy",
)
cancel_ok = fields.Boolean(
string="Can Cancel",
compute="_compute_policy",
Expand All @@ -167,6 +172,11 @@ def _compute_policy(self):
string="Can Restart",
compute="_compute_policy",
)
restart_approval_ok = fields.Boolean(
string="Can Restart Approval",
compute="_compute_policy",
store=False,
)

@api.model
def create(self, values):
Expand All @@ -188,10 +198,26 @@ def unlink(self):
_super = super(HrTimesheetAttendanceScheduleChange, self)
_super.unlink()

@api.multi
def validate_tier(self):
_super = super(HrTimesheetAttendanceScheduleChange, self)
_super.validate_tier()
for document in self:
if document.validated:
document.button_approve()

@api.multi
def restart_validation(self):
_super = super(HrTimesheetAttendanceScheduleChange, self)
_super.restart_validation()
for document in self:
document.request_validation()

@api.multi
def button_confirm(self):
for document in self:
document.write(document._prepare_confirm_data())
document.request_validation()

@api.multi
def button_approve(self):
Expand All @@ -205,6 +231,7 @@ def button_approve(self):
def button_cancel(self):
for document in self:
document.write(document._prepare_cancel_data())
document.restart_validation()

@api.multi
def button_restart(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2018-2019 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
Expand Down
21 changes: 11 additions & 10 deletions hr_timesheet_attendance_schedule/models/res_company.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).

from openerp import models, fields
Expand All @@ -18,31 +19,31 @@ class ResCompany(models.Model):
default=0.0,
required=True,
)
schedule_change_confirm_grp_ids = fields.Many2one(
schedule_change_confirm_grp_ids = fields.Many2many(
string="Allowed To Confirm Attendance Schedule Change",
comodel_name="res.groups",
relation="rel_company_2_group_schedule_change_confirm",
column1="company_id",
column2="group_id",
)
schedule_change_approve_grp_ids = fields.Many2one(
string="Allowed To Approve Attendance Schedule Change",
comodel_name="res.groups",
relation="rel_company_2_group_schedule_change_approve",
column1="company_id",
column2="group_id",
)
schedule_change_cancel_grp_ids = fields.Many2one(
schedule_change_cancel_grp_ids = fields.Many2many(
string="Allowed To Cancel Attendance Schedule Change",
comodel_name="res.groups",
relation="rel_company_2_group_schedule_change_cancel",
column1="company_id",
column2="group_id",
)
schedule_change_restart_grp_ids = fields.Many2one(
schedule_change_restart_grp_ids = fields.Many2many(
string="Allowed To Approve Attendance Schedule Change",
comodel_name="res.groups",
relation="rel_company_2_group_schedule_change_restart",
column1="company_id",
column2="group_id",
)
schedule_change_restart_val_grp_ids = fields.Many2many(
string="Allow To Restart Approval",
comodel_name="res.groups",
relation="rel_company_2_group_schedule_change_restart_val",
column1="company_id",
column2="group_id",
)
17 changes: 9 additions & 8 deletions hr_timesheet_attendance_schedule/models/res_config.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).

from openerp import models, fields
Expand All @@ -16,23 +17,23 @@ class ResConfig(models.TransientModel):
string="Late Attendance Buffer",
related="company_id.late_attendance_buffer",
)
schedule_change_confirm_grp_ids = fields.Many2one(
schedule_change_confirm_grp_ids = fields.Many2many(
string="Allowed To Confirm Attendance Schedule Change",
comodel_name="res.groups",
related="company_id.schedule_change_confirm_grp_ids",
)
schedule_change_approve_grp_ids = fields.Many2one(
string="Allowed To Approve Attendance Schedule Change",
comodel_name="res.groups",
related="company_id.schedule_change_approve_grp_ids",
)
schedule_change_cancel_grp_ids = fields.Many2one(
schedule_change_cancel_grp_ids = fields.Many2many(
string="Allowed To Cancel Attendance Schedule Change",
comodel_name="res.groups",
related="company_id.schedule_change_cancel_grp_ids",
)
schedule_change_restart_grp_ids = fields.Many2one(
schedule_change_restart_grp_ids = fields.Many2many(
string="Allowed To Restart Attendance Schedule Change",
comodel_name="res.groups",
related="company_id.schedule_change_restart_grp_ids",
)
schedule_change_restart_val_grp_ids = fields.Many2many(
string="Allowed To Restart Approval",
comodel_name="res.groups",
related="company_id.schedule_change_restart_val_grp_ids",
)
15 changes: 15 additions & 0 deletions hr_timesheet_attendance_schedule/models/tier_definition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2020 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openerp import api, models


class TierDefinition(models.Model):
_inherit = "tier.definition"

@api.model
def _get_tier_validation_model_names(self):
res = super(TierDefinition, self)._get_tier_validation_model_names()
res.append("hr.timesheet_attendance_schedule")
return res
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified hr_timesheet_attendance_schedule/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 Expand Up @@ -32,10 +33,6 @@
<label for="id" string="To Confirm" class="oe_inline"/>
<field name="schedule_change_confirm_grp_ids" widget="many2many_tags" class="oe_inline"/>
</div>
<div>
<label for="id" string="To Approve" class="oe_inline"/>
<field name="schedule_change_approve_grp_ids" widget="many2many_tags" class="oe_inline"/>
</div>
<div>
<label for="id" string="To Cancel" class="oe_inline"/>
<field name="schedule_change_cancel_grp_ids" widget="many2many_tags" class="oe_inline"/>
Expand All @@ -44,6 +41,10 @@
<label for="id" string="To Restart" class="oe_inline"/>
<field name="schedule_change_restart_grp_ids" widget="many2many_tags" class="oe_inline"/>
</div>
<div>
<label for="id" string="To Restart Approval" class="oe_inline"/>
<field name="schedule_change_restart_val_grp_ids" widget="many2many_tags" class="oe_inline"/>
</div>
</div>
</group>
</xpath>
Expand Down
Loading