Report shit sheet
This commit is contained in:
parent
1a2fd08cbc
commit
a9e340a2a4
27
__init__.py
27
__init__.py
|
@ -2,24 +2,25 @@
|
|||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
from .access import (StaffAccess, ReportHoursStart, ReportHoursWiz, ReportHours)
|
||||
from .shift import (Shift, ShiftLine, StaffSection, SectionEmployee, AddShift,
|
||||
AddShiftStart)
|
||||
import access
|
||||
import shift
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
StaffSection,
|
||||
Shift,
|
||||
ShiftLine,
|
||||
StaffAccess,
|
||||
SectionEmployee,
|
||||
AddShiftStart,
|
||||
ReportHoursStart,
|
||||
shift.StaffSection,
|
||||
shift.Shift,
|
||||
shift.ShiftLine,
|
||||
access.StaffAccess,
|
||||
shift.SectionEmployee,
|
||||
shift.AddShiftStart,
|
||||
access.ReportHoursStart,
|
||||
module='staff_access', type_='model')
|
||||
Pool.register(
|
||||
AddShift,
|
||||
ReportHoursWiz,
|
||||
shift.AddShift,
|
||||
access.ReportHoursWiz,
|
||||
module='staff_access', type_='wizard')
|
||||
Pool.register(
|
||||
ReportHours,
|
||||
access.ReportHours,
|
||||
shift.ShiftSheetReport,
|
||||
module='staff_access', type_='report')
|
||||
|
|
17
shift.py
17
shift.py
|
@ -6,9 +6,10 @@ from trytond.wizard import Wizard, StateView, Button, StateTransition
|
|||
from trytond.pyson import Eval
|
||||
from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.report import Report
|
||||
|
||||
__all__ = ['Shift', 'ShiftLine', 'StaffSection', 'SectionEmployee',
|
||||
'AddShift', 'AddShiftStart']
|
||||
'AddShift', 'AddShiftStart','ShiftSheetReport']
|
||||
|
||||
STATES = {'readonly': Eval('state') != 'draft'}
|
||||
|
||||
|
@ -143,7 +144,7 @@ class AddShift(Wizard):
|
|||
shift = Shift(ids[0])
|
||||
lines_to_create = []
|
||||
enter_hour_tz = datetime.time(
|
||||
self.start.enter_hour.hour + 5,
|
||||
self.start.enter_hour.hour + 5,
|
||||
self.start.enter_hour.minute)
|
||||
enter_ = datetime.datetime.combine(shift.shift_date, enter_hour_tz)
|
||||
exit_ = enter_ + datetime.timedelta(0, self.start.timework * 3600)
|
||||
|
@ -159,3 +160,15 @@ class AddShift(Wizard):
|
|||
}
|
||||
)
|
||||
return 'end'
|
||||
|
||||
|
||||
class ShiftSheetReport(Report):
|
||||
"Shift Sheet Report"
|
||||
__name__ = 'staff_access.shift_sheet_report'
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, records, data):
|
||||
report_context = super(ShiftSheetReport, cls).get_context(records, data)
|
||||
Company = Pool().get('company.company')
|
||||
report_context['company'] = Company(Transaction().context['company'])
|
||||
return report_context
|
||||
|
|
12
shift.xml
12
shift.xml
|
@ -81,5 +81,17 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<menuitem name="Sections" parent="staff.menu_configuration"
|
||||
sequence="40" id="menu_staff_section"
|
||||
action="act_staff_section_form"/>
|
||||
|
||||
<record model="ir.action.report" id="report_staff_shift_sheet">
|
||||
<field name="name">Shift Sheet</field>
|
||||
<field name="model">staff.shift</field>
|
||||
<field name="report_name">staff_access.shift_sheet_report</field>
|
||||
<field name="report">staff_access/shift_sheet.ods</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="report_staff_shift_sheet_keyword">
|
||||
<field name="keyword">form_print</field>
|
||||
<field name="model">staff.shift,-1</field>
|
||||
<field name="action" ref="report_staff_shift_sheet"/>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue