~pedro.baeza/+junk/quality-control

« back to all changes in this revision

Viewing changes to quality_control/qc_question.py

  • Committer: Pedro M. Baeza
  • Date: 2014-03-10 11:51:14 UTC
  • Revision ID: pedro.baeza@serviciosbaeza.com-20140310115114-d8pb8mm3mvgzs6k1
[ADD] quality_control: Initial upload.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    This program is free software: you can redistribute it and/or modify
 
5
#    it under the terms of the GNU Affero General Public License as
 
6
#    published by the Free Software Foundation, either version 3 of the
 
7
#    License, or (at your option) any later version.
 
8
#
 
9
#    This program is distributed in the hope that it will be useful,
 
10
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
#    GNU Affero General Public License for more details.
 
13
#
 
14
#    You should have received a copy of the GNU Affero General Public License
 
15
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
#
 
17
##############################################################################
 
18
from openerp.osv import fields, orm
 
19
 
 
20
class qc_question(orm.Model):
 
21
    """
 
22
    This model stores proofs which will be part of a test. Proofs are
 
23
    classified between qualitative (such as color) and quantitative
 
24
    (such as density).
 
25
    """
 
26
    _name = 'qc.question'
 
27
 
 
28
    _columns = {
 
29
        'name': fields.char('Name', size=200, required=True, select=True,
 
30
                translate=True),
 
31
        'ref': fields.char('Code', size=30, select=True),
 
32
        'type': fields.selection([('qualitative', 'Qualitative'),
 
33
                                  ('quantitative', 'Quantitative')],
 
34
                                  'Type', select=True, required=True),
 
35
        'value_ids': fields.many2many('qc.answer',
 
36
                'qc_answer_rel', 'question_id', 'answer_id',
 
37
                'Possible answers'),
 
38
        'company_id': fields.many2one('res.company', 'Company'),
 
39
    }
 
40
 
 
41
    _defaults = {
 
42
        'company_id': lambda self, cr, uid, c:
 
43
                self.pool.get('res.company')._company_default_get(cr, uid,
 
44
                        'qc.question', context=c),
 
45
    }