Commit abed1a51 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Simplify the database schema by moving responsibilities and hardware in

the history table taking benefit of the event.
parent 2e0637c4
......@@ -2,7 +2,7 @@
"""
from reporting_tools import (MySelector,
Hardware,
Base,
Person)
......@@ -13,13 +13,16 @@ def hardware():
# instantiate the selector
selector = MySelector(virtdb.hardware_selector)
# add constraint to select only hardware item
selector.append_query(db.events.event == 'laptop')
# define virtual field to compute time data
# to be added in the report via extra columns
db.hardware.duration = Field.Virtual(Hardware(selector).duration)
db.history.duration = Field.Virtual(Base(selector).duration)
# retrieve the records
orderfields = (db.hardware.model, db.people.last_name)
rows = selector.select_active_items(db.hardware, orderby=orderfields)
orderfields = (db.people.last_name, db.history.start_date)
rows = selector.select_active_items(db.history, orderby=orderfields)
# build the header and publish
header = '%s %s' % (T('List of hardware'), selector.header(db))
......@@ -54,7 +57,7 @@ def people():
selector = MySelector(virtdb.people_selector)
# add constraint to avoid 'stagiaire' category
selector.append_query(db.categories.usual != 'stagiaire')
selector.append_query(db.categories.category != 'stagiaire')
# add constraint to avoid event (phd, hdr, ...)
selector.append_query(db.history.id_events == undef_id)
......@@ -67,7 +70,7 @@ def people():
# retrieve the record
orderfields = (db.categories.usual, db.people.last_name)
orderfields = (db.categories.category, db.people.last_name)
rows = selector.select_active_items(db.history, orderby=orderfields)
# get the header and publish
......@@ -86,14 +89,17 @@ def responsibilities():
iframe = selector.download()
if iframe:
return iframe
# 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,
db.responsibilities.start_date)
db.history.start_date)
# retrieve the records
rows = selector.select_active_items(db.responsibilities, orderby=orderfields)
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))
......
......@@ -81,6 +81,28 @@ def import_csv():
return 'File "%s" import in "%s"' % (fn, tablename)
def copy():
"""Copy the content of the hardware table in history
"""
for row in db().select(db.responsibilities.ALL):
di = dict(id_people=row.id_people,
id_events=9,
start_date=row.start_date,
end_date=row.end_date,
percentage=None,
id_organizations=row.id_organizations,
id_levels=row.id_levels,
responsibility=row.responsibility,
note=row.note)
# db.history[0] = di
return 'hello'
def test():
""" test selection on date
......
doc/database.png

112 KB | W: | H:

doc/database.png

100 KB | W: | H:

doc/database.png
doc/database.png
doc/database.png
doc/database.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -22,4 +22,4 @@
<type label="Upload" length="0" sql="upload" quote="'"/>
<type label="Password" length="0" sql="password" quote="'"/>
</group>
</datatypes><table x="590" y="94" name="people"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="first_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="last_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="initials" null="0" autoincrement="0"><datatype>string</datatype></row><row name="birth_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="596" y="281" name="teams"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="team" null="0" autoincrement="0"><datatype>string</datatype></row><row name="domain" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="594" y="398" name="projects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="project" null="0" autoincrement="0"><datatype>string</datatype></row><row name="agencies" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="932" y="139" name="categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="usual" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="801" y="28" name="history"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="categories" row="id" /></row><row name="id_agencies" null="0" autoincrement="0"><datatype>integer</datatype><relation table="agencies" row="id" /></row><row name="id_events" null="0" autoincrement="0"><datatype>integer</datatype><relation table="events" row="id" /></row><row name="cdd_flag" null="0" autoincrement="0"><datatype>boolean</datatype><default>False</default></row><row name="start_date" null="0" autoincrement="0"><datatype>date</datatype></row><row name="end_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="percentage" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="stage_title" null="1" autoincrement="0"><datatype>text</datatype></row><row name="stage_university" null="1" autoincrement="0"><datatype>text</datatype></row><row name="note" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="327" y="56" name="responsibilities"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="1" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_organizations" null="0" autoincrement="0"><datatype>integer</datatype><relation table="organizations" row="id" /></row><row name="id_levels" null="0" autoincrement="0"><datatype>integer</datatype><relation table="levels" row="id" /></row><row name="responsibility" null="0" autoincrement="0"><datatype>string</datatype></row><row name="start_date" null="0" autoincrement="0"><datatype>date</datatype></row><row name="end_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="348" y="316" name="hardware"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="model" null="0" autoincrement="0"><datatype>string</datatype></row><row name="start_date" null="0" autoincrement="0"><datatype>date</datatype></row><row name="end_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="cost" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="109" y="154" name="organizations"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="organization" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="800" y="365" name="budgets"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><row name="id_lines" null="0" autoincrement="0"><datatype>integer</datatype><relation table="lines" row="id" /></row><row name="demanded" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="notified" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="executed" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="937" y="266" name="agencies"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="agency" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="147" y="264" name="levels"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="level" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="944" y="384" name="events"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="event" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definitiion" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="945" y="490" name="lines"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="line" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
</datatypes><table x="592" y="9" name="people"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="first_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="last_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="initials" null="0" autoincrement="0"><datatype>string</datatype></row><row name="birth_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="594" y="178" name="teams"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="team" null="0" autoincrement="0"><datatype>string</datatype></row><row name="domain" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="592" y="282" name="projects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="project" null="0" autoincrement="0"><datatype>string</datatype></row><row name="agencies" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="923" y="8" name="categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="category" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="779" y="27" name="history"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="categories" row="id" /></row><row name="id_agencies" null="0" autoincrement="0"><datatype>integer</datatype><relation table="agencies" row="id" /></row><row name="id_events" null="0" autoincrement="0"><datatype>integer</datatype><relation table="events" row="id" /></row><row name="cdd_flag" null="0" autoincrement="0"><datatype>boolean</datatype><default>False</default></row><row name="start_date" null="0" autoincrement="0"><datatype>date</datatype></row><row name="end_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="percentage" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="stage_title" null="1" autoincrement="0"><datatype>text</datatype></row><row name="stage_university" null="1" autoincrement="0"><datatype>text</datatype></row><row name="id_organizations" null="0" autoincrement="0"><datatype>integer</datatype><relation table="organizations" row="id" /></row><row name="id_levels" null="0" autoincrement="0"><datatype>integer</datatype><relation table="levels" row="id" /></row><row name="responsibility" null="1" autoincrement="0"><datatype>string</datatype></row><row name="hardware_model" null="1" autoincrement="0"><datatype>string</datatype></row><row name="hardware_cost" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="note" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="576" y="385" name="organizations"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="organization" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="397" y="41" name="budgets"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><row name="id_lines" null="0" autoincrement="0"><datatype>integer</datatype><relation table="lines" row="id" /></row><row name="demanded" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="notified" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="executed" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="928" y="142" name="agencies"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="agency" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="941" y="389" name="levels"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="level" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="935" y="253" name="events"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="event" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definitiion" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="245" y="106" name="lines"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="line" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
......@@ -12,6 +12,7 @@
'careers': 'carrières',
'categories': 'catégories',
'Category': 'Catégorie',
'Category1': 'Category1',
'Catégorie': 'Catégorie',
'CDD': 'CDD',
'Cdd': 'Cdd',
......@@ -23,6 +24,7 @@
'Controller': 'Controller',
'Cost': 'Coût',
'Coverage': 'Coverage',
'Coût': 'Coût',
'database schema': 'schéma de la base de données',
'Defined a year or a time period !!!': 'Defined a year or a time period !!!',
'Definition': 'Définition',
......@@ -52,11 +54,14 @@
'First Name': 'Prénom',
'Format': 'Format',
'Forms': 'Formulaire',
'FTE': 'FTE',
'General': 'Général',
'Grade': 'Grade',
'greater or equal to': 'plus grand ou égual à',
'hardware': 'matériel',
'Hardware': 'Hardware',
'Hardware Cost': 'Hardware Cost',
'Hardware Model': 'Hardware Model',
'HDR': 'HDR',
'Hdr': 'Hdr',
'Hdr Date': 'Hdr Date',
......@@ -80,6 +85,7 @@
'Lists': 'Lists',
'Max Records': 'Max Records',
'Model': 'Modèle',
'Modèle': 'Modèle',
'Name': 'Nom',
'Niveau': 'Niveau',
'Note': 'Note',
......@@ -130,6 +136,7 @@
'Université': 'Université',
'unknown': 'unknown',
'Usual': 'Habituel',
'value already in database or empty': 'value already in database or empty',
'versions': 'versions',
'Year': 'Année',
'Year End': 'Year End',
......
......@@ -62,13 +62,14 @@ db.define_table("agencies",
migrate="agencies.table")
db.define_table("categories",
Field("code", "string", notnull=True, label=T("Quality")),
Field("usual", "string", label=T("Category")),
Field("code", "string", notnull=True, unique=True, label=T("Quality")),
Field("category", "string", notnull=True),
Field("definition", "text"),
migrate="categories.table")
db.define_table("events",
Field("event", "string", notnull=True, unique=True),
Field("category", "string", notnull=True),
Field("definition", "text"),
migrate="events.table")
......@@ -135,28 +136,6 @@ db.budgets.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
db.define_table("hardware",
Field("id_people", db.people, default=undef_id, label='Person'),
Field("id_teams", db.teams, default=undef_id, label='Team'),
Field("id_projects", db.projects, default=undef_id, label='Project'),
Field("model", "string"),
Field("start_date", "date", default=today, notnull=True),
Field("end_date", "date"),
Field("cost", "double"),
Field("note", "text"),
migrate="hardware.table")
db.hardware.id_people.requires = \
IS_IN_DB(db, 'people.id', 'people.last_name')
db.hardware.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
db.hardware.id_projects.requires = \
IS_IN_DB(db, 'projects.id', 'projects.project')
db.define_table("history",
Field("id_people", db.people, default=undef_id, label='Person'),
Field("id_teams", db.teams, default=undef_id, label='Team'),
......@@ -170,6 +149,11 @@ db.define_table("history",
Field("percentage", "integer", default=100),
Field("stage_title", "text", label=T('Title')),
Field("stage_university", "text", label=T('University')),
Field("id_organizations", db.organizations, default=undef_id, label='Organization'),
Field("id_levels", db.levels, default=undef_id, label='Level'),
Field("responsibility", "text"),
Field("hardware_model", "string", label=T("Model")),
Field("hardware_cost", "double", label=T("Cost")),
Field("note", "text"),
migrate="history.table")
......@@ -182,6 +166,12 @@ IS_IN_DB(db, 'categories.id', 'categories.code')
db.history.id_events.requires = \
IS_IN_DB(db, 'events.id', 'events.event')
db.history.id_levels.requires = \
IS_IN_DB(db, 'levels.id', 'levels.level')
db.history.id_organizations.requires = \
IS_IN_DB(db, 'organizations.id', 'organizations.organization')
db.history.id_people.requires = \
IS_IN_DB(db, 'people.id', 'people.last_name')
......@@ -190,23 +180,3 @@ IS_IN_DB(db, 'projects.id', 'projects.project')
db.history.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
db.define_table("responsibilities",
Field("id_people", db.people, default=undef_id, label='Person'),
Field("id_organizations", db.organizations, default=undef_id, label='Organization'),
Field("id_levels", db.levels, default=undef_id, label='Level'),
Field("responsibility", "text"),
Field("start_date", "date", default=today, notnull=True),
Field("end_date", "date"),
Field("note", "text"),
migrate="responsibilities.table")
db.responsibilities.id_people.requires = \
IS_IN_DB(db, 'people.id', 'people.last_name')
db.responsibilities.id_levels.requires = \
IS_IN_DB(db, 'levels.id', 'levels.level')
db.responsibilities.id_organizations.requires = \
IS_IN_DB(db, 'organizations.id', 'organizations.organization')
......@@ -8,7 +8,7 @@ if not db(db.agencies.id).count():
db.agencies.insert(id=undef_id, agency=undef, definition=undef)
if not db(db.categories.id).count():
db.categories.insert(id=undef_id, code=undef, definition=undef)
db.categories.insert(id=undef_id, code=undef, category=undef, definition=undef)
if not db(db.events.id).count():
db.events.insert(id=undef_id, event=undef, definition=undef)
......
......@@ -9,17 +9,6 @@
fieldsModifier = dbui.FieldsModifier('budgets')
fieldsModifier.configure_field('id_people', editable='false', mode='local')
#
# hardware
#
fieldsModifier = dbui.FieldsModifier('hardware')
fieldsModifier.configure_field('start_date', flex=1)
fieldsModifier.configure_field('end_date', flex=1)
fieldsModifier.merge_fields('start_date', 'end_date', fieldLabel=T('Period'))
# select a person by typing first letters of his name in the combobox
fieldsModifier.configure_field('id_people', editable='false', mode='local')
#
# hardware selector
#
......@@ -56,17 +45,6 @@ fieldsModifier.configure_field('period_start', flex=1)
fieldsModifier.configure_field('period_end', flex=1)
fieldsModifier.merge_fields('period_start', 'period_end', fieldLabel=T('Period'))
#
# responsibilities
#
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'))
# select a person by typing first letters of his name in the combobox
fieldsModifier.configure_field('id_people', editable='false', mode='local')
#
# responsibilities selector
#
......
......@@ -21,12 +21,29 @@ formModifier.merge_fields('id_people',
flex=1)
formModifier.merge_fields('id_agencies',
'percentage',
'cdd_flag',
dbui.Spacer(height=75),
dbui.Spacer(height=100),
title=T('Contract'),
flex=1)
formModifier.merge_fields('percentage',
dbui.Spacer(height=126),
title=T('FTE'),
flex=1)
formModifier.merge_fields('id_organizations',
'id_levels',
'responsibility',
dbui.Spacer(height=36),
title=T('Responsibility'),
flex=1)
formModifier.merge_fields('hardware_model',
'hardware_cost',
dbui.Spacer(height=100),
title=T('Hardware'),
flex=1)
formModifier.merge_fields('stage_title',
'stage_university',
dbui.Spacer(height=25),
......@@ -42,7 +59,7 @@ formModifier.set_mapper(dbui.map_tabpanel)
formModifier.configure(buttonAlign='right',
labelWidth=80,
labelAlign='right',
width=350,
width=450,
height=270,
defaults={'height': 200})
......@@ -37,40 +37,32 @@ gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
gridModifier = dbui.GridModifier('categories')
gridModifier.configure_column('code', width=20)
gridModifier.configure_column('usual', width=20)
gridModifier.configure_column('category', width=20)
gridModifier.set_rownumbering()
#
# events
#
gridModifier = dbui.GridModifier('events')
gridModifier.configure_column('category', width=20)
gridModifier.configure_column('event', width=20)
gridModifier.set_rownumbering()
#
# hardware
#
gridModifier = dbui.GridModifier('hardware')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.hide_columns('id_projects', 'id_teams')
gridModifier.set_rownumbering()
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('model', 'contains', T('contains')))
gridModifier.append_filter(('start_date', '>=', T('greater or equal to')))
gridModifier.append_filter(('end_date', '<=', T('less or equal to')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# history
#
gridModifier = dbui.GridModifier('history')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.hide_columns('id_projects',
gridModifier.hide_columns('cdd_flag',
'id_levels',
'id_organizations',
'id_projects',
'id_agencies',
'hardware_cost',
'hardware_model',
'note',
'percentage',
'responsibility',
'stage_title',
'stage_university')
gridModifier.set_rownumbering()
......@@ -79,6 +71,7 @@ gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('id_categories', '==', T('is equal to')))
gridModifier.append_filter(('id_events', '==', T('is equal to')))
gridModifier.append_filter(('start_date', '>=', T('greater or equal to')))
gridModifier.append_filter(('end_date', '<=', T('less or equal to')))
......@@ -128,22 +121,6 @@ gridModifier = dbui.GridModifier('projects')
gridModifier.configure_column('project', width=20)
gridModifier.set_rownumbering()
#
# responsibilities
#
gridModifier = dbui.GridModifier('responsibilities')
gridModifier.configure_column('responsibility', width=400)
gridModifier.hide_columns('id_organizations', 'note')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.append_filter(('start_date', '>=', T('greater or equal to')))
gridModifier.append_filter(('end_date', '<=', T('less or equal to')))
gridModifier.set_rownumbering()
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_organizations', '==', T('is equal to')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# teams
#
......
......@@ -14,9 +14,25 @@ def repr_category(value, row):
return value
def repr_event(value, row):
if row.events.category == "responsabilité":
return row.history.responsibility
if value == undef:
return ''
return value
def repr_percentage(value, row):
if value and row.events.event == undef:
return value
return ''
repr_date = lambda date: (date.strftime('%d %b %Y') if date else '')
repr_flag = lambda flag: (CENTER('x') if flag else '')
repr_percentage = lambda val: ('' if val == None else val)
repr_undef = lambda val: ('' if val==undef else val)
#
......@@ -28,13 +44,8 @@ db.categories.code.represent = repr_category
#
# events
#
db.events.event.represent = repr_undef
#
# hardware
#
db.hardware.start_date.represent = repr_date
db.hardware.end_date.represent = repr_date
db.events.event.represent = repr_event
db.events.category.represent = repr_undef
#
# history
......@@ -59,12 +70,6 @@ db.people.birth_date.represent = repr_date
#
db.projects.project.represent = repr_undef
#
# responsibilities
#
db.responsibilities.start_date.represent = repr_date
db.responsibilities.end_date.represent = repr_date
#
# teams
#
......
......@@ -12,10 +12,7 @@ storeModifier = dbui.StoreModifier('categories')
storeModifier.orderby(db.categories.code)
storeModifier = dbui.StoreModifier('events')
storeModifier.orderby(db.events.event)
storeModifier = dbui.StoreModifier('hardware')
storeModifier.orderby(db.people.last_name, db.hardware.start_date)
storeModifier.orderby(db.events.category, db.events.event)
storeModifier = dbui.StoreModifier('history')
storeModifier.orderby(db.people.last_name, db.history.start_date)
......@@ -35,8 +32,5 @@ storeModifier.orderby(db.people.last_name)
storeModifier = dbui.StoreModifier('projects')
storeModifier.orderby(db.projects.project)
storeModifier = dbui.StoreModifier('responsibilities')
storeModifier.orderby(db.people.last_name, db.responsibilities.start_date)
storeModifier = dbui.StoreModifier('teams')
storeModifier.orderby(db.teams.team)
\ No newline at end of file
......@@ -126,17 +126,13 @@ class Base(object):
self.period_end = selector.period_end
class Hardware(Base):
"""Tool associate to a hardware item.
"""
def duration(self, row):
"""Compute the duration of an hardware item.
"""Compute the duration of an item.
Return a datetime.TimeDelta
"""
start = row.hardware.start_date
end = row.hardware.end_date
start = row.history.start_date
end = row.history.end_date
now = self.now
......
......@@ -7,14 +7,14 @@
# column with the hardware age
age = {'label': T('Duration'),
'class': '',
'content': lambda row, rc: repr_timedelta(row.hardware.duration),
'content': lambda row, rc: repr_timedelta(row.history.duration),
'selected': False,
'width': ''}
# render the table
table = SQLTABLE(rows,
columns=['people.last_name',
'hardware.model'],
'history.hardware_model'],
headers='labels',
extracolumns=[age],
renderstyle=True)
......
......@@ -19,7 +19,7 @@
# render the table
table = SQLTABLE(rows,
columns=['categories.usual',
columns=['categories.category',
'people.last_name',
'categories.code',
'history.percentage'],
......
......@@ -8,9 +8,9 @@
columns=['levels.level',
'people.last_name',
'organizations.organization',
'responsibilities.responsibility',
'responsibilities.start_date',
'responsibilities.end_date'],
'history.responsibility',
'history.start_date',
'history.end_date'],
headers='labels',
extracolumns=[],
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