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

Modify the database schema.

parent 8a2ed8cc
......@@ -12,7 +12,7 @@ def schema():
""" expose http://.../default/schema and display the database schema.
"""
return IMG(_src=URL("static", "database.png"), _width="99%")
return IMG(_src=URL("static", "database.png"), _height="99%")
def versions():
......
......@@ -65,7 +65,7 @@ def people():
# add constraints to select category of people
if selector.category:
selector.append_query(db.categories.category == selector.category)
selector.append_query(db.people_categories.category == selector.category)
# define virtual field to compute time data
# to be added in the report via extra columns
......@@ -75,7 +75,7 @@ def people():
# retrieve the record
orderfields = (db.categories.category, db.people.last_name)
orderfields = (db.people_categories.category, db.people.last_name)
rows = selector.select_active_items(db.history, orderby=orderfields)
# get the header and publish
......@@ -99,7 +99,7 @@ def responsibilities():
selector.append_query(db.events.category == 'responsabilité')
# order the records
orderfields = (db.levels.level,
orderfields = (db.organization_levels.level,
db.people.last_name,
db.history.start_date)
......@@ -119,14 +119,14 @@ def trainee():
selector = MySelector(virtdb.trainee_selector)
# add constraint to select only trainee item
selector.append_query(db.categories.category == 'stagiaire')
selector.append_query(db.people_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,
orderfields = (db.people_categories.category,
db.history.start_date,
db.people.last_name)
......
......@@ -20,14 +20,14 @@ def people():
selector.append_query(db.history.id_events == undef_id)
if selector.category:
selector.append_query(db.categories.category == selector.category)
selector.append_query(db.people_categories.category == selector.category)
# count the number of people per category
query = selector.query_active_items(db.history)
rows = db(query).select(db.categories.category,
rows = db(query).select(db.people_categories.category,
db.history.id.count(),
groupby=db.categories.category,
orderby=db.categories.category)
groupby=db.people_categories.category,
orderby=db.people_categories.category)
# count the number of FTE per category
# NOTE: aggregation does not work with virtual field
......@@ -37,11 +37,11 @@ def people():
fte = {}
mycat = None
orderby = db.categories.category
orderby = db.people_categories.category
for el in selector.select_active_items(db.history, orderby=orderby):
if el.categories.category != mycat:
mycat = el.categories.category
if el.people_categories.category != mycat:
mycat = el.people_categories.category
fte[mycat] = 0.
fte[mycat] += el.history.time_coverage * el.history.percentage * 0.01
......@@ -49,7 +49,7 @@ def people():
# add the FTE columns to the rows table
rows.colnames.append('FTE')
for row in rows.records:
row._extra['FTE'] = round(fte[row.categories.category], 2)
row._extra['FTE'] = round(fte[row.people_categories.category], 2)
# get the header and publish
header = '%s %s' % (T('List of people '), selector.header(db))
......
......@@ -81,28 +81,6 @@ 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
......
......@@ -31,7 +31,7 @@ def person():
db.history.insert(id_people=id_people,
id_teams=selector.id_teams,
id_project=selector.id_projects,
id_categories=selector.id_categories,
id_people_categories=selector.id_people_categories,
start_date=selector.start_date,
end_date=selector.end_date)
......@@ -62,13 +62,13 @@ def trainee():
birth_date=selector.birth_date)
# people category
id_category = get_id(db.categories, code=selector.stage_level)
id_people_category = get_id(db.people_categories, code=selector.stage_level)
# history section
id = db.history.insert(id_people=id_people,
id_teams=selector.id_teams,
id_projects=selector.id_projects,
id_categories=id_category,
id_people_categories=id_people_category,
start_date=selector.start_date,
end_date=selector.end_date,
cdd_flag=True,
......
doc/database.png

100 KB | W: | H:

doc/database.png

129 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="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
</datatypes><table x="231" y="31" 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="233" y="192" 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="233" y="292" 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="640" y="32" name="people_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="444" y="61" 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_people_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people_categories" row="id" /></row><row name="id_fundings" null="0" autoincrement="0"><datatype>integer</datatype><relation table="fundings" 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_organization_levels" null="0" autoincrement="0"><datatype>integer</datatype><relation table="organization_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="236" y="391" 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="650" y="154" name="fundings"><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="667" y="384" name="organization_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="661" y="261" 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></sql>
\ No newline at end of file
......@@ -59,6 +59,9 @@
'Format': 'Format',
'Forms': 'Formulaire',
'FTE': 'FTE',
'Funding': 'Financement',
'Fundings': 'Finacements',
'fundings': 'financements',
'General': 'Général',
'Grade': 'Grade',
'greater or equal to': 'plus grand ou égual à',
......@@ -96,9 +99,11 @@
'Note': 'Note',
'Notified': 'Notifié',
'Organization': 'Organisation',
'organization_levels': "niveau de l'organisation",
'organizations': 'organisations',
'people': 'personnel',
'People': 'Personnel',
'people_categories': 'catégories de personnel',
'Percentage': 'Pourcentage',
'Period': 'Periode',
'Period End': 'Period End',
......
......@@ -4,4 +4,4 @@
setup the connection to the databases
"""
db = DAL('sqlite://storage.sqlite', migrate=True)
db = DAL('sqlite://storage.sqlite', migrate_enabled=False)
......@@ -51,32 +51,26 @@ year = now.year
# basic tables
#
#-------------------------------------------------------------------------------
db.define_table("agencies",
Field("agency", "string", notnull=True, unique=True),
Field("definition", "text"),
migrate="agencies.table")
db.define_table("categories",
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")
db.define_table("levels",
Field("level", "string", notnull=True, unique=True),
db.define_table("fundings",
Field("agency", "string", notnull=True, unique=True),
Field("definition", "text"),
migrate="levels.table")
migrate="fundings.table")
db.define_table("lines",
Field("line", "string", notnull=True, unique=True),
db.define_table("organizations",
Field("organization", "string", notnull=True, unique=True),
Field("definition", "text"),
migrate="organizations.table")
db.define_table("organization_levels",
Field("level", "string", notnull=True, unique=True),
Field("definition", "text"),
migrate="lines.table")
migrate="organization_levels.table")
db.define_table("people",
Field("first_name", "string", notnull=True),
......@@ -86,14 +80,14 @@ db.define_table("people",
Field("note", "text"),
migrate="people.table")
db.define_table("organizations",
Field("organization", "string", notnull=True, unique=True),
db.define_table("people_categories",
Field("code", "string", notnull=True, unique=True, label=T("Quality")),
Field("category", "string", notnull=True),
Field("definition", "text"),
migrate="organizations.table")
migrate="people_categories.table")
db.define_table("projects",
Field("project", "string", notnull=True, unique=True),
Field("agencies", "string"),
migrate="projects.table")
db.define_table("teams",
......@@ -106,38 +100,13 @@ db.define_table("teams",
# core tables
#
#-------------------------------------------------------------------------------
db.define_table("budgets",
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("year", "integer", default=year, notnull=True),
Field("id_lines", db.lines, default=undef_id, label='Line'),
Field("demanded", "double"),
Field("notified", "double"),
Field("executed", "double"),
Field("note", "text"),
migrate="budgets.table")
db.budgets.id_lines.requires = \
IS_IN_DB(db, 'lines.id', 'lines.line')
db.budgets.id_people.requires = \
IS_IN_DB(db, 'people.id', 'people.last_name')
db.budgets.id_projects.requires = \
IS_IN_DB(db, 'projects.id', 'projects.project')
db.budgets.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
db.define_table("history",
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("id_categories", db.categories, default=undef_id, label='Category'),
Field("id_people_categories", db.people_categories, default=undef_id, label='Category'),
Field("cdd_flag", "boolean", default=False, label="CDD"),
Field("id_agencies", db.agencies, default=undef_id, label='Agency'),
Field("id_fundings", db.fundings, default=undef_id, label='Funding'),
Field("id_events", db.events, default=undef_id, label='Event'),
Field("start_date", "date", default=today, notnull=True),
Field("end_date", "date"),
......@@ -146,24 +115,24 @@ db.define_table("history",
Field("stage_university", "text", label=T('University')),
Field("stage_category", "string", default=undef, label=T("Type")),
Field("id_organizations", db.organizations, default=undef_id, label='Organization'),
Field("id_levels", db.levels, default=undef_id, label='Level'),
Field("id_organization_levels", db.organization_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")
db.history.id_agencies.requires = \
IS_IN_DB(db, 'agencies.id', 'agencies.agency')
db.history.id_fundings.requires = \
IS_IN_DB(db, 'fundings.id', 'fundings.agency')
db.history.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
db.history.id_people_categories.requires = \
IS_IN_DB(db, 'people_categories.id', 'people_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_organization_levels.requires = \
IS_IN_DB(db, 'organization_levels.id', 'orgainization_levels.level')
db.history.id_organizations.requires = \
IS_IN_DB(db, 'organizations.id', 'organizations.organization')
......
......@@ -7,14 +7,14 @@
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, category=undef, definition=undef)
if not db(db.people_categories.id).count():
db.people_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)
if not db(db.levels.id).count():
db.levels.insert(id=undef_id, level=undef, definition=undef)
if not db(db.organization_levels.id).count():
db.organization_levels.insert(id=undef_id, level=undef, definition=undef)
if not db(db.lines.id).count():
db.lines.insert(id=undef_id, line=undef, definition=undef)
......
......@@ -6,30 +6,30 @@
"""
if db(db.categories.id).count() == 1:
db.categories.insert(id=2, code='CR2')
db.categories.insert(id=3, code='CR1')
db.categories.insert(id=4, code='DR2')
db.categories.insert(id=5, code='DR1')
db.categories.insert(id=7, code='MRT')
db.categories.insert(id=8, code='ATER')
db.categories.insert(id=9, code='MC')
db.categories.insert(id=10, code='PR')
db.categories.insert(id=11, code='EMERITE')
db.categories.insert(id=12, code='AI')
db.categories.insert(id=13, code='IR2')
db.categories.insert(id=14, code='IR1')
db.categories.insert(id=15, code='IR0')
db.categories.insert(id=16, code='L3')
db.categories.insert(id=17, code='M1')
db.categories.insert(id=18, code='M2')
db.categories.insert(id=19, code='PHD')
db.categories.insert(id=20, code='ATER')
if db(db.people_categories.id).count() == 1:
db.people_categories.insert(id=2, code='CR2')
db.people_categories.insert(id=3, code='CR1')
db.people_categories.insert(id=4, code='DR2')
db.people_categories.insert(id=5, code='DR1')
db.people_categories.insert(id=7, code='MRT')
db.people_categories.insert(id=8, code='ATER')
db.people_categories.insert(id=9, code='MC')
db.people_categories.insert(id=10, code='PR')
db.people_categories.insert(id=11, code='EMERITE')
db.people_categories.insert(id=12, code='AI')
db.people_categories.insert(id=13, code='IR2')
db.people_categories.insert(id=14, code='IR1')
db.people_categories.insert(id=15, code='IR0')
db.people_categories.insert(id=16, code='L3')
db.people_categories.insert(id=17, code='M1')
db.people_categories.insert(id=18, code='M2')
db.people_categories.insert(id=19, code='PHD')
db.people_categories.insert(id=20, code='ATER')
if db(db.levels.id).count() == 1:
db.levels.insert(id=2, level='international')
db.levels.insert(id=3, level='local')
db.levels.insert(id=4, level='national')
if db(db.organization_levels.id).count() == 1:
db.organization_levels.insert(id=2, level='international')
db.organization_levels.insert(id=3, level='local')
db.organization_levels.insert(id=4, level='national')
if db(db.teams.id).count() == 1:
......
......@@ -74,8 +74,8 @@ virtdb.define_table('people_selector',
Field('id_projects', db.projects, label='Project'),
Field('format', 'string', default='html'))
rows = db().select(db.categories.category,
orderby=db.categories.category,
rows = db().select(db.people_categories.category,
orderby=db.people_categories.category,
distinct=True)
virtdb.people_selector.category.requires = \
......@@ -99,12 +99,12 @@ virtdb.define_table('person_wizard',
Field("birth_date", "date"),
Field("start_date", "date"),
Field("end_date", "date"),
Field("id_categories", db.categories, default=undef_id, label='Category'),
Field("id_people_categories", db.people_categories, default=undef_id, label='Category'),
Field("id_teams", db.teams, default=id_lhcb, label='Team'),
Field("id_projects", db.projects, default=undef_id, label='Project'))
virtdb.person_wizard.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
virtdb.person_wizard.id_people_categories.requires = \
IS_IN_DB(db, 'people_categories.id', 'people_categories.code')
virtdb.person_wizard.id_projects.requires = \
IS_IN_DB(db, 'projects.id', 'projects.project')
......@@ -120,14 +120,14 @@ virtdb.define_table('responsibilities_selector',
Field('period_start', 'date'),
Field('period_end', 'date'),
Field('id_people', db.people, label='Person'),
Field('id_organizations', db.organizations, label='Level'),
Field('id_organization_levels', db.organization_levels, 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.id_organization_levels.requires = \
IS_IN_DB(db, 'organization_levels.id', 'orgainzation_levels.level')
virtdb.responsibilities_selector.format.requires = IS_IN_SET(['html', 'csv'])
......@@ -164,8 +164,9 @@ IS_IN_DB(db, 'teams.id', 'teams.team')
virtdb.trainee_wizard.stage_category.requires = \
IS_IN_SET(('PHY', 'IR'))
rows = db(db.categories.category=='stagiaire').select(db.categories.code,
orderby=db.categories.code)
query = db.people_categories.category=='stagiaire'
rows = db(query).select(db.people_categories.code,
orderby=db.people_categories.code)
virtdb.trainee_wizard.stage_level.requires = \
IS_IN_SET((el.code for el in rows))
......@@ -2,13 +2,6 @@
""" fields widgets
"""
#
# budget
#
# select a person by typing first letters of his name in the combobox
fieldsModifier = dbui.FieldsModifier('budgets')
fieldsModifier.configure_field('id_people', editable='false', mode='local')
#
# hardware selector
#
......
......@@ -14,16 +14,16 @@ formModifier = dbui.FormModifier('history')
formModifier.merge_fields('id_people',
'id_teams',
'id_projects',
'id_categories',
'id_people_categories',
'id_events',
'start_date',
title=T('General'),
flex=1)
formModifier.merge_fields('id_agencies',
formModifier.merge_fields('id_fundings',
'cdd_flag',
dbui.Spacer(height=100),
title=T('Contract'),
title=T('Fundings'),
flex=1)
formModifier.merge_fields('percentage',
......@@ -32,7 +32,7 @@ formModifier.merge_fields('percentage',
flex=1)
formModifier.merge_fields('id_organizations',
'id_levels',
'id_organization_levels',
'responsibility',
dbui.Spacer(height=36),
title=T('Responsibility'),
......
......@@ -10,28 +10,6 @@ dbui.configure_grids(db, plugins=['pGridRowEditorConfirmDelete',
'pGridRowEditorDblClick',
'pGridExpertMenu'])
#
# categories
#
gridModifier = dbui.GridModifier('agencies')
gridModifier.configure_column('agency', width=40)
gridModifier.set_rownumbering()
#
# budgets
#
gridModifier = dbui.GridModifier('budgets')
gridModifier.append_plugins('pGridPaging', 'pGridExpertMenu')
gridModifier.set_rownumbering()
gridModifier.append_filter(('year', '==', T('is equal to')))
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_lines', '==', T('is equal to')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# categories
#
......@@ -48,16 +26,23 @@ gridModifier.configure_column('category', width=20)
gridModifier.configure_column('event', width=20)
gridModifier.set_rownumbering()
#
# fundings
#
gridModifier = dbui.GridModifier('fundings')
gridModifier.configure_column('agency', width=40)
gridModifier.set_rownumbering()
#
# history
#
gridModifier = dbui.GridModifier('history')
gridModifier.append_plugins('pGridPaging', 'pGridExpertMenu')
gridModifier.hide_columns('cdd_flag',
'id_levels',
'id_organization_levels',
'id_organizations',
'id_projects',
'id_agencies',
'id_fundings',
'hardware_cost',
'hardware_model',
'note',
......@@ -71,7 +56,7 @@ 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(('id_categories', '==', T('is equal to')))
gridModifier.append_filter(('id_people_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')))
......@@ -79,26 +64,19 @@ gridModifier.append_filter(('end_date', '<=', T('less or equal to')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# lines
# organizations
#
gridModifier = dbui.GridModifier('lines')
gridModifier.configure_column('line', width=20)
gridModifier = dbui.GridModifier('organizations')
gridModifier.configure_column('organization', width=20)
gridModifier.set_rownumbering()
#
# levels
# organization_levels
#
gridModifier = dbui.GridModifier('levels')