Release 6.0
This commit is contained in:
parent
b030dd6088
commit
8a867b8d0d
|
@ -2,8 +2,8 @@
|
|||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
import access
|
||||
import shift
|
||||
from . import access
|
||||
from . import shift
|
||||
|
||||
|
||||
def register():
|
||||
|
|
19
access.py
19
access.py
|
@ -9,9 +9,8 @@ from trytond.pool import Pool
|
|||
from trytond.wizard import Wizard, StateView, Button, StateReport, StateTransition
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['StaffAccess', 'AddAccessGroup', 'AddAccessGroupStart']
|
||||
|
||||
from trytond.i18n import gettext
|
||||
from .exceptions import StaffAccessEnterError
|
||||
STATES = {'readonly': (Eval('state') == 'done')}
|
||||
|
||||
|
||||
|
@ -37,9 +36,6 @@ class StaffAccess(Workflow, ModelSQL, ModelView):
|
|||
def __setup__(cls):
|
||||
super(StaffAccess, cls).__setup__()
|
||||
cls._order.insert(0, ('enter_timestamp', 'ASC'))
|
||||
cls._error_messages.update({
|
||||
'error_exit_timestamp': ('Invalid enter timestamp %s or exit timestamp %s for employee %s!'),
|
||||
})
|
||||
cls._transitions |= set((
|
||||
('open', 'close'),
|
||||
('close', 'done'),
|
||||
|
@ -78,8 +74,11 @@ class StaffAccess(Workflow, ModelSQL, ModelView):
|
|||
if self.exit_timestamp:
|
||||
timework = self.exit_timestamp - self.enter_timestamp
|
||||
if timework.days >= 2 or self.exit_timestamp < self.enter_timestamp:
|
||||
self.raise_user_error('error_exit_timestamp', (str(self.enter_timestamp),
|
||||
str(self.exit_timestamp), self.employee.party.name))
|
||||
raise StaffAccessEnterError(
|
||||
gettext('staff_access.msg_error_exit_timestamp',
|
||||
enter_timestamp=str(self.enter_timestamp),
|
||||
exit_timestamp=str(self.exit_timestamp),
|
||||
employee=self.employee.party.name))
|
||||
|
||||
@classmethod
|
||||
def write(cls, access, vals):
|
||||
|
@ -130,8 +129,8 @@ class ReportHours(Report):
|
|||
__name__ = 'staff.access_hours.report'
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, records, data):
|
||||
report_context = super(ReportHours, cls).get_context(records, data)
|
||||
def get_context(cls, records, header, data):
|
||||
report_context = super().get_context(records, header, data)
|
||||
pool = Pool()
|
||||
user = pool.get('res.user')(Transaction().user)
|
||||
Access = pool.get('staff.access')
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.model.exceptions import ValidationError
|
||||
from trytond.exceptions import UserError, UserWarning
|
||||
|
||||
|
||||
class StaffAccessEnterError(UserError):
|
||||
pass
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_error_exit_timestamp">
|
||||
<field name="text">Invalid enter timestamp "%(enter_timestamp)" or exit timestamp "%(exit_timestamp)" for employee "%(employee)"!</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
2
setup.py
2
setup.py
|
@ -104,10 +104,10 @@ setup(name=name,
|
|||
'Natural Language :: Slovenian',
|
||||
'Natural Language :: Spanish',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Programming Language :: Python :: Implementation :: PyPy',
|
||||
'Topic :: Office/Business',
|
||||
|
|
11
shift.py
11
shift.py
|
@ -7,10 +7,6 @@ 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','ShiftSheetReport']
|
||||
|
||||
STATES = {'readonly': Eval('state') != 'draft'}
|
||||
|
||||
|
||||
|
@ -33,9 +29,6 @@ class Shift(Workflow, ModelSQL, ModelView):
|
|||
def __setup__(cls):
|
||||
super(Shift, cls).__setup__()
|
||||
cls._order.insert(0, ('shift_date', 'DESC'))
|
||||
cls._error_messages.update({
|
||||
'error_exit_timestamp': ('Invalid exit timestamp!'),
|
||||
})
|
||||
cls._transitions |= set((
|
||||
('draft', 'confirmed'),
|
||||
('confirmed', 'draft'),
|
||||
|
@ -167,8 +160,8 @@ class ShiftSheetReport(Report):
|
|||
__name__ = 'staff_access.shift_sheet_report'
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, records, data):
|
||||
report_context = super(ShiftSheetReport, cls).get_context(records, data)
|
||||
def get_context(cls, records, header, data):
|
||||
report_context = super().get_context(records, header, data)
|
||||
Company = Pool().get('company.company')
|
||||
report_context['company'] = Company(Transaction().context['company'])
|
||||
return report_context
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=5.0.1
|
||||
version=6.0.0
|
||||
depends:
|
||||
party
|
||||
company
|
||||
|
|
Loading…
Reference in New Issue