Commit 5929ca3b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the list of responsibilities in html and csv.

parent 04d855d6
......@@ -69,4 +69,27 @@ def people():
# get the header and publish
header = '%s %s' % (T('List of people '), selector.header(db))
return dict(footer='', header=header, rows=rows)
\ No newline at end of file
return dict(footer='', header=header, rows=rows)
def responsibilities():
"""Active responsibilities for a person, a given period of time, ...
"""
# instantiate the selector
selector = MySelector(virtdb.responsibilities_selector)
# handle the format
iframe = selector.download()
if iframe:
return iframe
# retrieve the records
orderfields = (db.organizations.level,
db.people.last_name,
db.responsibilities.start_date)
rows = selector.select_active_items(db.responsibilities, orderby=orderfields)
# build the header and publish
header = '%s %s' % (T('List of responsibilities'), selector.header(db))
return dict(footer='', header=header, rows=rows)
......@@ -69,6 +69,7 @@
'List of hardware': 'Liste de matériel',
'List of people': 'Liste de personne',
'List of people ': 'Liste des personnes ',
'List of responsibilities': 'Liste des responsabilités',
'Lists': 'Lists',
'Max Records': 'Max Records',
'Model': 'Modèle',
......
......@@ -70,3 +70,21 @@ IS_IN_DB(db, 'teams.id', 'teams.team')
virtdb.people_selector.format.requires = IS_IN_SET(['html'])
#
# responsibilities selector
#
virtdb.define_table('responsibilities_selector',
Field('year', 'integer'),
Field('period_start', 'date'),
Field('period_end', 'date'),
Field('id_people', db.people, label='Person'),
Field('id_organizations', db.organizations, label='Level'),
Field('format', 'string', default='html'))
virtdb.responsibilities_selector.id_people.requires = \
IS_IN_DB(db, 'people.id', 'people.last_name')
virtdb.responsibilities_selector.id_organizations.requires = \
IS_IN_DB(db, 'organizations.id', 'orgainzations.level')
virtdb.responsibilities_selector.format.requires = IS_IN_SET(['html', 'csv'])
......@@ -53,3 +53,11 @@ fieldsModifier = dbui.FieldsModifier('responsibilities')
fieldsModifier.configure_field('start_date', flex=1)
fieldsModifier.configure_field('end_date', flex=1)
fieldsModifier.merge_fields('start_date', 'end_date', fieldLabel=T('Period'))
#
# responsibilities selector
#
fieldsModifier = dbui.FieldsModifier('responsibilities_selector')
fieldsModifier.configure_field('period_start', flex=1)
fieldsModifier.configure_field('period_end', flex=1)
fieldsModifier.merge_fields('period_start', 'period_end', fieldLabel=T('Period'))
......@@ -2,9 +2,9 @@
""" widgets sqltable
"""
repr_date = lambda date, row: date.strftime('%d %b %Y')
repr_flag = lambda flag, row: (CENTER('x') if flag else '')
repr_undef = lambda val, row: ('' if val==undef else val)
repr_date = lambda date: (date.strftime('%d %b %Y') if date else '')
repr_flag = lambda flag: (CENTER('x') if flag else '')
repr_undef = lambda val: ('' if val==undef else val)
#
# hardware
......
......@@ -42,10 +42,21 @@ historyNode = dbui.PanelWithUrlSelector(baseUrl=url,
selectorCfg=selector,
selectorCollapsible=False)
fields = dbui.to_fields(virtdb.responsibilities_selector)
selector = dbui.FieldSet(items=fields,
plugins=['pFormToolTip'],
title=T('Select'))
url = '/'+request.application+'/list/responsibilities'
responsibilitiesNode = dbui.PanelWithUrlSelector(baseUrl=url,
panelCfg=dbui.Panel(),
selectorCfg=selector,
selectorCollapsible=False)
reportNode = dbui.Node(T('Reports'))
reportNode.add_child(T('History'), historyNode)
reportNode.add_child(T('List of hardware'), hardwareNode)
reportNode.add_child(T('List of people'), peopleNode)
reportNode.add_child(T('List of responsibilities'), responsibilitiesNode)
reportNode.sort_children()
#
......
......@@ -20,7 +20,8 @@
'projects.project',
'categories.code',
'history.cdd_flag',
'history.start_date'],
'history.start_date',
'history.percentage'],
headers='labels',
extracolumns=[duration],
renderstyle=True)
......
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