1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
23
from osv import osv, fields
25
class training_questionnaire(osv.osv):
26
_name = 'training.questionnaire'
27
training_questionnaire()
29
class training_course(osv.osv):
30
_inherit = 'training.course'
33
'questionnaire_ids' : fields.one2many('training.questionnaire',
40
class training_offer(osv.osv):
41
_inherit = 'training.offer'
43
'questionnaire_ids' : fields.many2many('training.questionnaire',
44
'training_questionnaire_offer_rel',
52
class training_question(osv.osv):
53
_name= 'training.question'
56
class training_exam_answer(osv.osv):
57
_name = 'training.exam_answer'
58
_description = 'Answer'
60
'name' : fields.char('Response', size=128, required=True, select=1),
61
'is_response' : fields.boolean('Correct Answer'),
62
'question_id' : fields.many2one('training.question', 'Question', select=True, required=True),
64
training_exam_answer()
66
class training_question(osv.osv):
67
_name = 'training.question'
68
_description = 'Question'
70
'name' : fields.text('Question', required=True, select=1),
71
'kind' : fields.selection([('mandatory', 'Mandatory'),
72
('eliminatory', 'Eliminatory'),
75
'Kind', required=True, select=1),
76
'type' : fields.selection([('plain', 'Plain'),
83
'response_plain' : fields.text('Response Plain'),
84
'response_yesno' : fields.boolean('Response Yes/No'),
85
'exam_answer_ids' : fields.one2many('training.exam_answer',
88
'questionnaire_ids': fields.many2many('training.questionnaire',
89
'training_questionnaire_question_rel',
96
'kind' : lambda *a: 'normal',
97
'type' : lambda *a: 'plain',
98
'response_yesno' : lambda *a: False,
103
class training_questionnaire(osv.osv):
104
_name = 'training.questionnaire'
105
_description = 'Questionnaire'
108
'name' : fields.char( 'Name', size=32, required=True, select=1 ),
109
'course_id' : fields.many2one('training.course', 'Course'),
110
'state' : fields.selection([('draft', 'Draft'),
111
('validated', 'Validated'),
112
('pending', 'Pending'),
113
('inprogress', 'In Progress'),
114
('deprecated', 'Deprecated')
116
'State', required=True, readonly=True, select=1),
117
'objective' : fields.text('Objective'),
118
'description' : fields.text('Description'),
119
'question_ids' : fields.many2many('training.question',
120
'training_questionnaire_question_rel',
122
'question_id', 'Questions'),
126
'state' : lambda *a: 'draft',
129
training_questionnaire()
131
class training_planned_exam(osv.osv):
132
_name = 'training.planned_exam'
133
_description = 'Planned Exam'
135
'name' : fields.char('Name', size=64, select=1, required=True),
136
'date' : fields.datetime('Date', required=False, select=1),
137
'duration' : fields.float('Duration', required=False, select=1),
138
# 'location_id' : fields.many2one('training.location',
139
'state' : fields.selection([('draft', 'Draft'),
140
('opened', 'Opened'),
141
('opened_confirmed', 'Opened Confirmed'),
142
('closed_confirmed', 'Closed Confirmed'),
143
('inprogress', 'In Progress'),
144
('closed', 'Closed'),
145
('cancelled', 'Cancelled')],
151
'participant_ids' : fields.many2many('training.subscription',
152
'training_participation',
156
domain="[('group_id', '=', group_id)]" ),
157
'group_id' : fields.many2one('training.group', 'Group'),
158
'contact_ids' : fields.many2many('res.partner.contact', 'planned_exam_contact_rel',
159
'planned_exam_id', 'contact_id',
161
'questionnaire_id' : fields.many2one('training.questionnaire',
164
'subscription_line_id' : fields.many2one('training.subscription.line', 'Subscription'),
168
'state' : lambda *a: 'draft',
171
training_planned_exam()
173
class training_subscription_line(osv.osv):
174
_inherit = 'training.subscription.line'
176
'with_exam' : fields.boolean('With Exam'),
177
'exam_id' : fields.one2many('training.planned_exam', 'Planned Exam'),
180
'with_exam' : lambda *a: 0,
183
training_subscription_line()
185
class training_exam_result(osv.osv):
186
_name = 'training.exam.result'
187
_description = 'exam Result'
189
'participation_id' : fields.many2one('training.participation', 'Participation',
191
'exam_id' : fields.many2one('training.planned_exam', 'Exam',
195
training_exam_result()
197
#class training_exam_result_line(osv.osv):
198
# _name = 'training.exam.result.line'
200
# 'question_id' : fields.many2one('training.question', 'Question', required=True),
203
#training_exam_result_line()
207
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: