Skip to content

Commit

Permalink
[8.0.3.1.0] hr_timesheet_attendance_schedule
Browse files Browse the repository at this point in the history
* Generate schedule from working schedule on timesheet
  • Loading branch information
andhit-r committed Mar 20, 2019
1 parent b0842b0 commit 8075c8b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hr_timesheet_attendance_schedule/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2018-2019 OpenSynergy 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.0.0",
"version": "8.0.3.1.0",
"category": "Human Resource",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
Expand Down
13 changes: 11 additions & 2 deletions hr_timesheet_attendance_schedule/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2018-2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api
Expand All @@ -21,6 +21,10 @@ class HrTimesheetSheet(models.Model):
],
},
)
working_schedule_id = fields.Many2one(
string="Working Schedule",
comodel_name="resource.calendar",
)

@api.multi
def action_create_attendance_schedule(self):
Expand Down Expand Up @@ -52,7 +56,12 @@ def _create_attendance_schedule(self):
if not contract.working_hours:
return True

schedules = contract.working_hours._schedule_days(
if self.working_schedule_id:
working_schedule = self.working_schedule_id
else:
working_schedule = contract.working_hours

schedules = working_schedule._schedule_days(
days=duration,
day_date=dt_start)

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

<openerp>
Expand All @@ -11,6 +11,9 @@
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='company_id']" position="after">
<field name="working_schedule_id"/>
</xpath>
<xpath expr="//page[@string='Attendances']" position="after">
<page name="attendance_schedule" string="Attendance Schedules">
<field name="attendance_schedule_ids" colspan="4" nolabel="1">
Expand Down

0 comments on commit 8075c8b

Please sign in to comment.