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

Move the field history.cdd_flag to the data block for people events and remove...

Move the field history.cdd_flag to the data block for people events and remove it from the interface.
parent a3777d10
......@@ -51,7 +51,7 @@
'Conditions': 'Conditions',
'Configuration': 'Configuration',
'Configure': 'Configurer',
'Configure lists': 'Configure lists',
'Configure lists': 'Configurer les listes',
'contains': 'contiens',
'Contract': 'Contrat',
'Controller': 'Controller',
......
......@@ -7,7 +7,6 @@ db.define_table("history",
Field("id_teams", "reference teams", default=undef_id, label='Team'),
Field("id_projects", "reference projects", default=undef_id, label='Project'),
Field("id_people_categories", "reference people_categories", default=undef_id, label='Category'),
Field("cdd_flag", "boolean", default=False, label="CDD"),
Field("id_fundings", "reference fundings", default=undef_id, label='Funding'),
Field("id_events", "reference events", default=undef_id, label='Event'),
Field("start_date", "date", default=today, notnull=True),
......
......@@ -37,7 +37,6 @@ formModifier.merge_fields('start_date',
title=T('Period'))
formModifier.merge_fields('id_fundings',
'cdd_flag',
title=T('Fundings'))
formModifier.merge_fields('note',
......
# -*- coding: utf-8 -*-
""" NAME
fix-cdd
SYNOPSIS
Move the history.cdd field to the history data block.
DESCRIPTION
In the new design the CDD field is a part of the data block
for the event people. this script migrate the information
for the history.cdd_flag to history.data["cdd"].
OPTIONS
-h, --help
Display the help and exit.
EXAMPLE
> cd ...track_lhcbfrance/scripts
> ./run fix-cdd
AUTHOR
R. Le Gac -- Jan 2015
"""
if __name__ == "__main__":
import re
import sys
from argparse import ArgumentParser
# command line options
parser = ArgumentParser()
args = parser.parse_args()
# scan the history table
query = db.history.id_events == 6
for row in db(query).select():
print db.people[row.id_people].last_name, row.cdd_flag
db.history[row.id] = dict(data={"cdd": row.cdd_flag})
# commit and close
rep = raw_input("Commit change [n]?")
if rep.lower().startswith('y'):
db.commit()
print "database modified"
sys.exit(0)
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