Commit 0bbc835e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the logic for the list of trainee.

parent 52f52763
......@@ -97,7 +97,7 @@ def responsibilities():
# add constraint to select only hardware item
selector.append_query(db.events.category == 'responsabilité')
# order the records
orderfields = (db.levels.level,
db.people.last_name,
......@@ -109,3 +109,30 @@ def responsibilities():
# columns to be shown in the report
header = '%s %s' % (T('List of responsibilities'), selector.header(db))
return dict(footer='', header=header, rows=rows)
def trainee():
"""Active trainee for a given period of time...
"""
# instantiate the selector
selector = MySelector(virtdb.trainee_selector)
# add constraint to select only trainee item
selector.append_query(db.categories.category == 'stagiaire')
# define virtual field to compute time data
# to be added in the report via extra columns
db.history.duration = Field.Virtual(Person(selector).duration)
# order the records
orderfields = (db.categories.category,
db.history.start_date,
db.people.last_name)
# retrieve the records
rows = selector.select_active_items(db.history, orderby=orderfields)
# columns to be shown in the report
header = '%s %s' % (T('List of responsibilities'), selector.header(db))
return dict(footer='', header=header, rows=rows)
......@@ -86,6 +86,7 @@
'List of people': 'Liste de personne',
'List of people ': 'Liste des personnes ',
'List of responsibilities': 'Liste des responsabilités',
'List of trainee': 'Liste des stagiaires',
'Lists': 'Lists',
'Max Records': 'Max Records',
'Model': 'Modèle',
......
......@@ -30,12 +30,16 @@ respLeaf = dbui.to_panelWithUrlSelector(virtdb.responsibilities_selector,
baseUrl=URL('list', 'responsibilities'))
traineeLeaf = dbui.to_panelWithUrlSelector(virtdb.trainee_selector,
baseUrl=URL('list', 'trainee'))
reportNode = dbui.Node(T('Reports'))
reportNode.add_child(T('Count people'), countPeopleLeaf)
reportNode.add_child(T('History'), historyLeaf)
reportNode.add_child(T('List of hardware'), hardwareLeaf)
reportNode.add_child(T('List of people'), listPeopleLeaf)
reportNode.add_child(T('List of responsibilities'), respLeaf)
reportNode.add_child(T('List of trainee'), traineeLeaf)
reportNode.sort_children()
#
......
{{=H1(header)}}
<br>
<br>
{{
from reporting_tools import repr_timedelta
# column with the duration spent in each step
duration = {'label': T('Duration'),
'class': '',
'content': lambda row, rc: repr_timedelta(row.history.duration),
'selected': False,
'width': ''}
# render the table
table = SQLTABLE(rows,
columns=['people.last_name',
'categories.code',
'history.start_date',
'history.end_date'],
headers='labels',
extracolumns=[duration],
renderstyle=True)
response.write(CENTER(table))
}}
{{=footer}}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment