1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from osv import fields,osv,orm
26 ('open','In Progress'),
27 ('cancel', 'Refused'),
32 AVAILABLE_PRIORITIES = [
41 class hr_applicant(osv.osv):
42 _name = "hr.applicant"
43 _description = "Applicant Cases"
47 'date_closed': fields.datetime('Closed', readonly=True),
48 'date': fields.datetime('Date'),
49 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Appreciation'),
50 'job_id': fields.many2one('hr.job', 'Applied Job'),
51 'salary_proposed': fields.float('Proposed Salary'),
52 'salary_expected': fields.float('Expected Salary'),
53 'availability': fields.integer('Availability (Days)'),
54 'partner_name': fields.char("Applicant's Name", size=64),
55 'partner_phone': fields.char('Phone', size=32),
56 'partner_mobile': fields.char('Mobile', size=32),
57 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
58 'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
59 'department_id':fields.many2one('hr.department','Department'),
60 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
61 'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
62 'response' : fields.integer("Response"),
65 def action_print_survey(self, cr, uid, ids, context=None):
67 If response is available then print this response otherwise print survey form(print template of the survey).
69 @param self: The object pointer
70 @param cr: the current row, from the database cursor,
71 @param uid: the current user’s ID for security checks,
72 @param ids: List of Survey IDs
73 @param context: A standard dictionary for contextual values
74 @return : Dictionary value for print survey form.
79 record = self.read(cr, uid, ids, ['survey', 'response'])
80 page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1}
83 datas['ids'] = [record[0]['survey'][0]]
84 response_id = record[0]['response']
86 context.update({'survey_id': datas['ids'], 'response_id' : [response_id], 'response_no':0,})
87 datas['form'] = page_setting
88 datas['model'] = 'survey.print.answer'
90 'type': 'ir.actions.report.xml',
91 'report_name': 'survey.browse.response',
97 datas['form'] = page_setting
98 datas['model'] = 'survey.print'
100 'type': 'ir.actions.report.xml',
101 'report_name': 'survey.form',
110 class hr_job(osv.osv):
114 'survey_id': fields.many2one('survey', 'Survey'),