[MERGE] sync with trunk

bzr revid: mat@openerp.com-20140411154002-6557tcjfetqwb0kf
This commit is contained in:
Martin Trigaux 2014-04-11 17:40:02 +02:00
commit 236a4d71be
102 changed files with 5762 additions and 17024 deletions

View File

@ -86,10 +86,10 @@ openerp.account = function (instance) {
var self = this;
var ids = this.get_selected_ids();
if (ids.length === 0) {
instance.web.dialog($("<div />").text(_t("You must choose at least one record.")), {
new instance.web.Dialog(this, {
title: _t("Warning"),
modal: true
});
size: 'medium',
}, $("<div />").text(_t("You must choose at least one record."))).open();
return false;
}

View File

@ -88,15 +88,12 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
var qdict = {
current_layout : this.$el.find('.oe_dashboard').attr('data-layout')
};
var $dialog = instance.web.dialog($('<div>'), {
modal: true,
var $dialog = instance.web.Dialog(this, {
title: _t("Edit Layout"),
width: 'auto',
height: 'auto'
}).html(QWeb.render('DashBoard.layouts', qdict));
}, QWeb.render('DashBoard.layouts', qdict)).open();
$dialog.find('li').click(function() {
var layout = $(this).attr('data-layout');
$dialog.dialog('destroy');
$dialog.modal('hide');
self.do_change_layout(layout);
});
},

View File

@ -40,7 +40,6 @@ If you need to manage your meetings, you should install the CRM module.
'website': 'http://www.openerp.com',
'demo': ['calendar_demo.xml'],
'data': [
'security/calendar_security.xml',
'security/ir.model.access.csv',
'calendar_view.xml',
'contacts_view.xml',

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record model="res.groups" id="base.group_survey_user">
<field name="name">Survey / User</field>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
</data>
</openerp>

View File

@ -1,7 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_calendar_attendee,calendar.attendee,model_calendar_attendee,,1,1,1,1
access_calendar_alarm,calendar.alarm,model_calendar_alarm,base.group_user,1,1,1,1
access_calendar_attendee_survey_user,calendar.attendee,model_calendar_attendee,base.group_survey_user,1,0,0,0
access_calendar_event_manager,calendar.event.manager,model_calendar_event,base.group_sale_manager,1,1,1,1
access_calendar_event,calendar.event,model_calendar_event,base.group_sale_salesman,1,1,1,0
access_calendar_event_all,calendar.event_all,model_calendar_event,base.group_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_calendar_attendee calendar.attendee model_calendar_attendee 1 1 1 1
3 access_calendar_alarm calendar.alarm model_calendar_alarm base.group_user 1 1 1 1
access_calendar_attendee_survey_user calendar.attendee model_calendar_attendee base.group_survey_user 1 0 0 0
4 access_calendar_event_manager calendar.event.manager model_calendar_event base.group_sale_manager 1 1 1 1
5 access_calendar_event calendar.event model_calendar_event base.group_sale_salesman 1 1 1 0
6 access_calendar_event_all calendar.event_all model_calendar_event base.group_user 1 1 1 1

View File

@ -269,14 +269,13 @@ class gamification_goal(osv.Model):
'cr': cr,
'context': dict(context), # copy context to prevent side-effects of eval
'uid': uid,
'result': False,
'date': date, 'datetime': datetime, 'timedelta': timedelta, 'time': time
}
code = definition.compute_code.strip()
safe_eval(code, cxt, mode="exec", nocopy=True)
# the result of the evaluated codeis put in the 'result' local variable, propagated to the context
result = cxt.get('result', False)
if result and type(result) in (float, int, long):
result = cxt.get('result')
if result is not None and type(result) in (float, int, long):
if result != goal.current:
goals_to_write[goal.id]['current'] = result
else:

View File

@ -20,22 +20,24 @@
##############################################################################
{
'name' : 'Employee Appraisals',
'name': 'Employee Appraisals',
'version': '0.1',
'author': 'OpenERP SA',
'category': 'Human Resources',
'sequence': 31,
'website': 'http://www.openerp.com',
'summary': 'Periodical Evaluations, Appraisals, Surveys',
'images': ['images/hr_evaluation_analysis.jpeg','images/hr_evaluation.jpeg','images/hr_interview_requests.jpeg'],
'depends': ['hr','calendar','survey'],
'images': ['images/hr_evaluation_analysis.jpeg',
'images/hr_evaluation.jpeg',
'images/hr_interview_requests.jpeg'],
'depends': ['hr', 'calendar', 'survey'],
'description': """
Periodical Employees evaluation and appraisals
==============================================
By using this application you can maintain the motivational process by doing periodical evaluations of your employees' performance. The regular assessment of human resources can benefit your people as well your organization.
By using this application you can maintain the motivational process by doing periodical evaluations of your employees' performance. The regular assessment of human resources can benefit your people as well your organization.
An evaluation plan can be assigned to each employee. These plans define the frequency and the way you manage your periodic personal evaluations. You will be able to define steps and attach interview forms to each step.
An evaluation plan can be assigned to each employee. These plans define the frequency and the way you manage your periodic personal evaluations. You will be able to define steps and attach interview forms to each step.
Manages several types of evaluations: bottom-up, top-down, self-evaluations and the final evaluation by the manager.
@ -47,23 +49,22 @@ Key Features
* Every evaluation filled by employees can be viewed in a PDF form.
* Interview Requests are generated automatically by OpenERP according to employees evaluation plans. Each user receives automatic emails and requests to perform a periodical evaluation of their colleagues.
""",
"demo": ["hr_evaluation_demo.xml"],
"data": [
'security/ir.model.access.csv',
'security/hr_evaluation_security.xml',
'hr_evaluation_view.xml',
'report/hr_evaluation_report_view.xml',
'board_hr_evaluation_view.xml',
'survey_data_appraisal.xml',
'hr_evaluation_data.xml',
'hr_evaluation_installer.xml',
],
'test': [
'test/test_hr_evaluation.yml',
'test/hr_evalution_demo.yml',
],
"demo": ["hr_evaluation_demo.xml"],
# 'test': [
# 'test/test_hr_evaluation.yml',
# 'test/hr_evalution_demo.yml',
# ],
'auto_install': False,
'installable': True,
'application': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,15 +19,17 @@
#
##############################################################################
from datetime import datetime
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from dateutil import parser
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as DF
class hr_evaluation_plan(osv.osv):
class hr_evaluation_plan(osv.Model):
_name = "hr_evaluation.plan"
_description = "Appraisal Plan"
_columns = {
@ -42,11 +44,11 @@ class hr_evaluation_plan(osv.osv):
'active': True,
'month_first': 6,
'month_next': 12,
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
}
class hr_evaluation_plan_phase(osv.osv):
class hr_evaluation_plan_phase(osv.Model):
_name = "hr_evaluation.plan.phase"
_description = "Appraisal Plan Phase"
_order = "sequence"
@ -54,13 +56,13 @@ class hr_evaluation_plan_phase(osv.osv):
'name': fields.char("Phase", size=64, required=True),
'sequence': fields.integer("Sequence"),
'company_id': fields.related('plan_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
'plan_id': fields.many2one('hr_evaluation.plan','Appraisal Plan', ondelete='cascade'),
'plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan', ondelete='cascade'),
'action': fields.selection([
('top-down','Top-Down Appraisal Requests'),
('bottom-up','Bottom-Up Appraisal Requests'),
('self','Self Appraisal Requests'),
('final','Final Interview')], 'Action', required=True),
'survey_id': fields.many2one('survey','Appraisal Form',required=True),
('top-down', 'Top-Down Appraisal Requests'),
('bottom-up', 'Bottom-Up Appraisal Requests'),
('self', 'Self Appraisal Requests'),
('final', 'Final Interview')], 'Action', required=True),
'survey_id': fields.many2one('survey.survey', 'Appraisal Form', required=True),
'send_answer_manager': fields.boolean('All Answers',
help="Send all answers to the manager"),
'send_answer_employee': fields.boolean('All Answers',
@ -72,15 +74,14 @@ class hr_evaluation_plan_phase(osv.osv):
'wait': fields.boolean('Wait Previous Phases',
help="Check this box if you want to wait that all preceding phases " +
"are finished before launching this phase."),
'mail_feature': fields.boolean('Send mail for this phase', help="Check this box if you want to send mail to employees"+
" coming under this phase"),
'mail_feature': fields.boolean('Send mail for this phase', help="Check this box if you want to send mail to employees coming under this phase"),
'mail_body': fields.text('Email'),
'email_subject':fields.text('char')
'email_subject': fields.text('Subject')
}
_defaults = {
'sequence': 1,
'email_subject': _('''Regarding '''),
'mail_body': lambda *a:_('''
'mail_body': lambda *a: _('''
Date: %(date)s
Dear %(employee_name)s,
@ -98,26 +99,24 @@ Thanks,
}
class hr_employee(osv.osv):
class hr_employee(osv.Model):
_name = "hr.employee"
_inherit="hr.employee"
_inherit = "hr.employee"
_columns = {
'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan'),
'evaluation_date': fields.date('Next Appraisal Date', help="The date of the next appraisal is computed by the appraisal plan's dates (first appraisal + periodicity)."),
}
def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None): # cronjob
now = parser.parse(datetime.now().strftime('%Y-%m-%d'))
obj_evaluation = self.pool.get('hr_evaluation.evaluation')
emp_ids =self.search(cr, uid, [ ('evaluation_plan_id','<>',False), ('evaluation_date','=', False)], context=context)
emp_ids = self.search(cr, uid, [('evaluation_plan_id', '<>', False), ('evaluation_date', '=', False)], context=context)
for emp in self.browse(cr, uid, emp_ids, context=context):
first_date = (now+ relativedelta(months=emp.evaluation_plan_id.month_first)).strftime('%Y-%m-%d')
first_date = (now + relativedelta(months=emp.evaluation_plan_id.month_first)).strftime('%Y-%m-%d')
self.write(cr, uid, [emp.id], {'evaluation_date': first_date}, context=context)
emp_ids =self.search(cr, uid, [
('evaluation_plan_id','<>',False), ('evaluation_date','<=', time.strftime("%Y-%m-%d")),
], context=context)
emp_ids = self.search(cr, uid, [('evaluation_plan_id', '<>', False), ('evaluation_date', '<=', time.strftime("%Y-%m-%d"))], context=context)
for emp in self.browse(cr, uid, emp_ids, context=context):
next_date = (now + relativedelta(months=emp.evaluation_plan_id.month_next)).strftime('%Y-%m-%d')
self.write(cr, uid, [emp.id], {'evaluation_date': next_date}, context=context)
@ -126,39 +125,35 @@ class hr_employee(osv.osv):
return True
class hr_evaluation(osv.osv):
class hr_evaluation(osv.Model):
_name = "hr_evaluation.evaluation"
_inherit = "mail.thread"
_description = "Employee Appraisal"
_rec_name = 'employee_id'
_columns = {
'date': fields.date("Appraisal Deadline", required=True, select=True),
'employee_id': fields.many2one('hr.employee', "Employee", required=True),
'note_summary': fields.text('Appraisal Summary'),
'note_action': fields.text('Action Plan',
help="If the evaluation does not meet the expectations, you can propose"+
"an action plan"),
'note_action': fields.text('Action Plan', help="If the evaluation does not meet the expectations, you can propose an action plan"),
'rating': fields.selection([
('0','Significantly bellow expectations'),
('1','Did not meet expectations'),
('2','Meet expectations'),
('3','Exceeds expectations'),
('4','Significantly exceeds expectations'),
('0', 'Significantly below expectations'),
('1', 'Do not meet expectations'),
('2', 'Meet expectations'),
('3', 'Exceeds expectations'),
('4', 'Significantly exceeds expectations'),
], "Appreciation", help="This is the appreciation on which the evaluation is summarized."),
'survey_request_ids': fields.one2many('hr.evaluation.interview','evaluation_id','Appraisal Forms'),
'survey_request_ids': fields.one2many('hr.evaluation.interview', 'evaluation_id', 'Appraisal Forms'),
'plan_id': fields.many2one('hr_evaluation.plan', 'Plan', required=True),
'state': fields.selection([
('draft','New'),
('cancel','Cancelled'),
('wait','Plan In Progress'),
('progress','Waiting Appreciation'),
('done','Done'),
('draft', 'New'),
('cancel', 'Cancelled'),
('wait', 'Plan In Progress'),
('progress', 'Waiting Appreciation'),
('done', 'Done'),
], 'Status', required=True, readonly=True),
'date_close': fields.date('Ending Date', select=True),
}
_defaults = {
'date': lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
'date': lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months=+1)).strftime('%Y-%m-%d'),
'state': lambda *a: 'draft',
}
@ -169,7 +164,8 @@ class hr_evaluation(osv.osv):
res = []
for record in reads:
name = record.plan_id.name
res.append((record['id'], name))
employee = record.employee_id.name_related
res.append((record['id'], name + ' / ' + employee))
return res
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
@ -183,7 +179,6 @@ class hr_evaluation(osv.osv):
return {'value': vals}
def button_plan_in_progress(self, cr, uid, ids, context=None):
mail_message = self.pool.get('mail.message')
hr_eval_inter_obj = self.pool.get('hr.evaluation.interview')
if context is None:
context = {}
@ -202,10 +197,9 @@ class hr_evaluation(osv.osv):
int_id = hr_eval_inter_obj.create(cr, uid, {
'evaluation_id': evaluation.id,
'survey_id': phase.survey_id.id,
'date_deadline': (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
'phase_id': phase.id,
'deadline': (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months=+1)).strftime('%Y-%m-%d'),
'user_id': child.user_id.id,
'user_to_review_id': evaluation.employee_id.id
}, context=context)
if phase.wait:
wait = True
@ -214,7 +208,7 @@ class hr_evaluation(osv.osv):
if (not wait) and phase.mail_feature:
body = phase.mail_body % {'employee_name': child.name, 'user_signature': child.user_id.signature,
'eval_name': phase.survey_id.title, 'date': time.strftime('%Y-%m-%d'), 'time': time }
'eval_name': phase.survey_id.title, 'date': time.strftime('%Y-%m-%d'), 'time': time}
sub = phase.email_subject
if child.work_email:
vals = {'state': 'outgoing',
@ -224,32 +218,32 @@ class hr_evaluation(osv.osv):
'email_from': evaluation.employee_id.work_email}
self.pool.get('mail.mail').create(cr, uid, vals, context=context)
self.write(cr, uid, ids, {'state':'wait'}, context=context)
self.write(cr, uid, ids, {'state': 'wait'}, context=context)
return True
def button_final_validation(self, cr, uid, ids, context=None):
request_obj = self.pool.get('hr.evaluation.interview')
self.write(cr, uid, ids, {'state':'progress'}, context=context)
self.write(cr, uid, ids, {'state': 'progress'}, context=context)
for evaluation in self.browse(cr, uid, ids, context=context):
if evaluation.employee_id and evaluation.employee_id.parent_id and evaluation.employee_id.parent_id.user_id:
self.message_subscribe_users(cr, uid, [evaluation.id], user_ids=[evaluation.employee_id.parent_id.user_id.id], context=context)
if len(evaluation.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', evaluation.id),('state', 'in', ['done','cancel'])], context=context)):
raise osv.except_osv(_('Warning!'),_("You cannot change state, because some appraisal(s) are in waiting answer or draft state."))
if len(evaluation.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', evaluation.id), ('state', 'in', ['done', 'cancel'])], context=context)):
raise osv.except_osv(_('Warning!'), _("You cannot change state, because some appraisal forms have not been completed."))
return True
def button_done(self, cr, uid, ids, context=None):
self.write(cr, uid, ids,{'state':'done', 'date_close': time.strftime('%Y-%m-%d')}, context=context)
self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')}, context=context)
return True
def button_cancel(self, cr, uid, ids, context=None):
interview_obj=self.pool.get('hr.evaluation.interview')
interview_obj = self.pool.get('hr.evaluation.interview')
evaluation = self.browse(cr, uid, ids[0], context)
interview_obj.survey_req_cancel(cr, uid, [r.id for r in evaluation.survey_request_ids])
self.write(cr, uid, ids,{'state':'cancel'}, context=context)
self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
return True
def button_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids,{'state': 'draft'}, context=context)
self.write(cr, uid, ids, {'state': 'draft'}, context=context)
return True
def copy(self, cr, uid, id, default=None, context=None):
@ -260,65 +254,90 @@ class hr_evaluation(osv.osv):
default = default.copy()
default['survey_request_ids'] = []
return super(hr_evaluation, self).copy(cr, uid, id, default, context=context)
def write(self, cr, uid, ids, vals, context=None):
if vals.get('employee_id'):
employee_id = self.pool.get('hr.employee').browse(cr, uid, vals.get('employee_id'), context=context)
if employee_id.parent_id and employee_id.parent_id.user_id:
vals['message_follower_ids'] = [(4, employee_id.parent_id.user_id.partner_id.id)]
if 'date' in vals:
new_vals = {'date_deadline': vals.get('date')}
new_vals = {'deadline': vals.get('date')}
obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview')
for evalutation in self.browse(cr, uid, ids, context=context):
for survey_req in evalutation.survey_request_ids:
for evaluation in self.browse(cr, uid, ids, context=context):
for survey_req in evaluation.survey_request_ids:
obj_hr_eval_iterview.write(cr, uid, [survey_req.id], new_vals, context=context)
return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context)
class survey_request(osv.osv):
_inherit = "survey.request"
_columns = {
'is_evaluation': fields.boolean('Is Appraisal?'),
}
class hr_evaluation_interview(osv.osv):
class hr_evaluation_interview(osv.Model):
_name = 'hr.evaluation.interview'
_inherits = {'survey.request': 'request_id'}
_inherit = 'mail.thread'
_rec_name = 'request_id'
_inherit = 'mail.thread'
_rec_name = 'user_to_review_id'
_description = 'Appraisal Interview'
_columns = {
'request_id': fields.many2one('survey.request','Request_id', ondelete='cascade', required=True),
'user_to_review_id': fields.many2one('hr.employee', 'Employee to Interview'),
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Appraisal Form'),
'request_id': fields.many2one('survey.user_input', 'Survey Request', ondelete='cascade', readonly=True),
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Appraisal Plan', required=True),
'phase_id': fields.many2one('hr_evaluation.plan.phase', 'Appraisal Phase', required=True),
'user_to_review_id': fields.related('evaluation_id', 'employee_id', type="many2one", relation="hr.employee", string="Employee to evaluate"),
'user_id': fields.many2one('res.users', 'Interviewer'),
'state': fields.selection([('draft', "Draft"),
('waiting_answer', "In progress"),
('done', "Done"),
('cancel', "Cancelled")],
string="State", required=True),
'survey_id': fields.related('phase_id', 'survey_id', string="Appraisal Form", type="many2one", relation="survey.survey"),
'deadline': fields.related('request_id', 'deadline', type="datetime", string="Deadline"),
}
_defaults = {
'is_evaluation': True,
'state': 'draft'
}
def create(self, cr, uid, vals, context=None):
phase_obj = self.pool.get('hr_evaluation.plan.phase')
survey_id = phase_obj.read(cr, uid, vals.get('phase_id'), fields=['survey_id'], context=context)['survey_id'][0]
if vals.get('user_id'):
user_obj = self.pool.get('res.users')
partner_id = user_obj.read(cr, uid, vals.get('user_id'), fields=['partner_id'], context=context)['partner_id'][0]
else:
partner_id = None
user_input_obj = self.pool.get('survey.user_input')
if not vals.get('deadline'):
vals['deadline'] = (datetime.now() + timedelta(days=28)).strftime(DF)
ret = user_input_obj.create(cr, uid, {'survey_id': survey_id,
'deadline': vals.get('deadline'),
'type': 'link',
'partner_id': partner_id}, context=context)
vals['request_id'] = ret
return super(hr_evaluation_interview, self).create(cr, uid, vals, context=context)
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
reads = self.browse(cr, uid, ids, context=context)
res = []
for record in reads:
name = record.request_id.survey_id.title
name = record.survey_id.title
res.append((record['id'], name))
return res
def survey_req_waiting_answer(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, { 'state': 'waiting_answer'}, context=context)
request_obj = self.pool.get('survey.user_input')
for interview in self.browse(cr, uid, ids, context=context):
request_obj.action_survey_resent(cr, uid, [interview.id], context=context)
self.write(cr, uid, interview.id, {'state': 'waiting_answer'}, context=context)
return True
def survey_req_done(self, cr, uid, ids, context=None):
hr_eval_obj = self.pool.get('hr_evaluation.evaluation')
for id in self.browse(cr, uid, ids, context=context):
flag = False
wating_id = 0
if not id.evaluation_id.id:
raise osv.except_osv(_('Warning!'),_("You cannot start evaluation without Appraisal."))
records = hr_eval_obj.browse(cr, uid, [id.evaluation_id.id], context=context)[0].survey_request_ids
raise osv.except_osv(_('Warning!'), _("You cannot start evaluation without Appraisal."))
records = id.evaluation_id.survey_request_ids
for child in records:
if child.state == "draft":
wating_id = child.id
@ -327,35 +346,29 @@ class hr_evaluation_interview(osv.osv):
flag = True
if not flag and wating_id:
self.survey_req_waiting_answer(cr, uid, [wating_id], context=context)
self.write(cr, uid, ids, { 'state': 'done'}, context=context)
return True
def survey_req_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, { 'state': 'draft'}, context=context)
self.write(cr, uid, ids, {'state': 'done'}, context=context)
return True
def survey_req_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, { 'state': 'cancel'}, context=context)
self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
return True
def action_print_survey(self, cr, uid, ids, context=None):
"""
If response is available then print this response otherwise print survey form(print template of the survey).
""" If response is available then print this response otherwise print survey form (print template of the survey) """
context = context if context else {}
interview = self.browse(cr, uid, ids, context=context)[0]
survey_obj = self.pool.get('survey.survey')
response_obj = self.pool.get('survey.user_input')
response = response_obj.browse(cr, uid, interview.request_id.id, context=context)
context.update({'survey_token': response.token})
return survey_obj.action_print_survey(cr, uid, [interview.survey_id.id], context=context)
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Survey IDs
@param context: A standard dictionary for contextual values
@return: Dictionary value for print survey form.
"""
if context is None:
context = {}
record = self.browse(cr, uid, ids, context=context)
record = record and record[0]
context.update({'survey_id': record.survey_id.id, 'response_id': [record.response.id], 'response_no':0,})
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
return value
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1
def action_start_survey(self, cr, uid, ids, context=None):
context = context if context else {}
interview = self.browse(cr, uid, ids, context=context)[0]
survey_obj = self.pool.get('survey.survey')
response_obj = self.pool.get('survey.user_input')
# grab the token of the response and start surveying
response = response_obj.browse(cr, uid, interview.request_id.id, context=context)
context.update({'survey_token': response.token})
return survey_obj.action_start_survey(cr, uid, [interview.survey_id.id], context=context)

File diff suppressed because it is too large Load Diff

View File

@ -21,24 +21,26 @@
<field name="model">hr_evaluation.plan</field>
<field name="arch" type="xml">
<form string="Appraisal Plan" version="7.0">
<group col="4">
<group>
<field name="name"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="active"/>
<sheet>
<group col="4">
<group>
<field name="name"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="active"/>
</group>
<group>
<field name="month_first"/>
<field name="month_next"/>
</group>
</group>
<group>
<field name="month_first"/>
<field name="month_next"/>
</group>
</group>
<notebook>
<page string="Appraisal Phases">
<notebook>
<page string="Appraisal Phases">
<field name="phase_ids"/>
</page>
</notebook>
</page>
</notebook>
</sheet>
</form>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_hr_evaluation_plan_tree">
<field name="name">hr_evaluation.plan.form</field>
@ -58,9 +60,9 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Appraisal Interviews Action -->
<record id="act_hr_employee_2_hr__evaluation_interview" model="ir.actions.act_window">
<field name="res_model">hr.evaluation.interview</field>
<field name="view_type">form</field>
@ -127,7 +129,7 @@
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="action"/>
<field name="survey_id"/>
<field name="survey_id" domain="[('res_model','=','hr_evaluation')]"/>
<field name="wait"/>
</tree>
</field>
@ -165,11 +167,9 @@
</header>
<sheet>
<label for="employee_id" class="oe_edit_only"/>
<h1><field name="employee_id" class="oe_inline"
attrs="{'readonly': [('state', '=', 'done')]}"
on_change="onchange_employee_id(employee_id)"/>,
<field name="date"
attrs="{'readonly': [('state', '=', 'done')]}"/>
<h1>
<field name="employee_id" class="oe_inline" attrs="{'readonly': [('state', '=', 'done')]}" on_change="onchange_employee_id(employee_id)"/>
<field name="date" attrs="{'readonly': [('state', '=', 'done')]}"/>
</h1>
<label for="plan_id" class="oe_edit_only"/>
<h2><field name="plan_id" attrs="{'readonly': [('state', '=', 'done')]}"/></h2>
@ -180,31 +180,7 @@
</group>
</group>
<group string="Appraisal Forms" attrs="{'invisible':[('state','=','draft')]}">
<field nolabel="1" name="survey_request_ids" attrs="{'readonly': [('state', '=', 'done')]}">
<form string="Interview Appraisal" version="7.0">
<div class="oe_right oe_button_box">
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done" icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0,}" attrs="{'readonly':[('response','=',False)]}" />
</div>
<group>
<group>
<field name="survey_id"/>
<field name="user_to_review_id"/>
<field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>
</group>
<group>
<field name="date_deadline"/>
<field name="response" readonly="1"/>
</group>
</group>
<group col="4" string="Status" invisible="1">
<field name="state"/>
<div>
<button string="Done" name="survey_req_done" states="waiting_answer" type="object" icon="gtk-jump-to" />
</div>
</group>
</form>
</field>
<field nolabel="1" name="survey_request_ids" attrs="{'readonly': [('state', '=', 'done')]}" />
</group>
<group string="Internal Notes" attrs="{'invisible':[('state','=','draft')]}">
<field nolabel="1" name="note_action"
@ -230,7 +206,6 @@
<field name="employee_id"/>
<field name="plan_id"/>
<field name="date"/>
<!--field name="progress" widget="progressbar"/-->
<field name="rating"/>
<field name="state"/>
</tree>
@ -289,15 +264,10 @@
<header>
<button string="Cancel Survey" name="survey_req_cancel" type="object"
states="draft,waiting_answer" class="oe_left"/>
<button string="Print Survey" name="action_print_survey" type="object"
states="draft" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}"
attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
<button string="Print Survey" name="action_print_survey" type="object" states='waiting_answer,done' attrs="{'readonly':[('survey_id','=',False)]}"/>
<button string="Send Request" name="survey_req_waiting_answer" type="object"
states="draft" class="oe_highlight"/>
<button string="Answer Survey" name="%(survey.action_view_survey_question_message)d" type="action"
states="waiting_answer" class="oe_highlight"
context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}"
attrs="{'readonly':[('survey_id','=',False)]}"/>
<button string="Answer Survey" class="oe_highlight" name="action_start_survey" type="object" states='waiting_answer' attrs="{'readonly':[('request_id','=',False)]}"/>
<button string="Done" name="survey_req_done" type="object"
states="waiting_answer"/>
<field name="state" widget="statusbar" statusbar_visible="waiting_answer,done"/>
@ -306,19 +276,22 @@
<div class="oe_right oe_button_box" name="button_box">
<button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" type="action"
states="waiting_answer"
context="{'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
context="{'default_body': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_subject': 'Reminder to fill up Survey' }"/>
</div>
<group>
<group>
<field name="survey_id"/>
<field name="user_to_review_id"/>
<field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>
<field name="evaluation_id" string="Appraisal"/>
<field name="phase_id"/>
<field name="user_to_review_id" readonly="1"/>
</group>
<group>
<field name="date_deadline"/>
<field name="response" readonly="1"/>
<field name="evaluation_id" string="Appraisal Plan"/>
<field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>
<field name="deadline"/>
</group>
<group>
<field name="request_id"/>
<field name="survey_id" domain="[('res_model','=','hr_evaluation')]" readonly="1"/>
</group>
</group>
</sheet>
@ -326,18 +299,18 @@
</field>
</record>
<record model="ir.ui.view" id="view_hr_evaluation_interview_tree">
<record model="ir.ui.view" id="view_hr_evaluation_interview_tree">
<field name="name">hr_evaluation.interview.tree</field>
<field name="model">hr.evaluation.interview</field>
<field name="arch" type="xml">
<tree string="Interview Appraisal">
<field name="date_deadline" string="Deadline Date"/>
<field name="survey_id"/>
<field name="deadline" string="Deadline Date"/>
<field name="survey_id" domain="[('res_model','=','hr_evaluation')]"/>
<field name="user_id" string="Interviewer"/>
<field name="user_to_review_id"/>
<field name="response" readonly="1" invisible="True"/>
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response, 'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="action_print_survey" string="Print Survey" type="object" icon="gtk-print" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<field name="request_id" readonly="1" invisible="True"/>
<button name="action_start_survey" string="Answer Survey" type="object" icon="gtk-execute" attrs="{'readonly':[('request_id','=',False)]}"/>
<button name="action_print_survey" string="Print Survey" type="object" icon="gtk-print" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(mail.action_email_compose_message_wizard)d" string="Send Reminder Email" icon="terp-mail-message-new" type="action" states="waiting_answer"/>
<field name="state"/>
<button string="Send Request" name="survey_req_waiting_answer" states="draft" type="object" icon="gtk-yes" />
@ -351,7 +324,7 @@
<field name="model">hr.evaluation.interview</field>
<field name="arch" type="xml">
<search string="Search Appraisal">
<field name="date_deadline"/>
<field name="deadline"/>
<filter icon="terp-gtk-go-back-rtl" string="To Do" name="todo" domain="[('state','=','waiting_answer')]"/>
<field name="user_to_review_id"/>
<field name="user_id" string="Interviewer"/>
@ -368,7 +341,7 @@
<field name="name">Interview Requests</field>
<field name="model">hr.evaluation.interview</field>
<field name="arch" type="xml">
<calendar string="Interview Request" color="user_to_review_id" date_start="date_deadline">
<calendar string="Interview Request" color="user_to_review_id" date_start="deadline">
<field name="request_id"/>
</calendar>
</field>
@ -379,12 +352,11 @@
<field name="res_model">hr.evaluation.interview</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="domain">[('is_evaluation' ,'=', True)]</field>
<field name="context">{'default_is_evaluation': True, "search_default_todo":1,"search_default_user_id":uid}</field>
<field name="context">{"search_default_todo":1,"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_hr_evaluation_interview_search"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new interview request related to a personal evaluation.
Click to create a new interview request related to a personal evaluation.
</p><p>
Interview requests are usually generated automatically by
OpenERP according to an employee's appraisal plan. Each user
@ -425,7 +397,7 @@
target="new" multi="True"
key2="client_action_multi"
context="{'default_composition_mode': 'mass_mail',
'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_body': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_subject': 'Reminder to fill up Survey'}"/>
</data>

View File

@ -22,41 +22,43 @@
from openerp import tools
from openerp.osv import fields, osv
class hr_evaluation_report(osv.osv):
class hr_evaluation_report(osv.Model):
_name = "hr.evaluation.report"
_description = "Evaluations Statistics"
_auto = False
_columns = {
'create_date': fields.date('Create Date', readonly=True),
'delay_date':fields.float('Delay to Start', digits=(16,2),readonly=True),
'overpass_delay':fields.float('Overpassed Deadline', digits=(16,2), readonly=True),
'delay_date': fields.float('Delay to Start', digits=(16, 2), readonly=True),
'overpass_delay': fields.float('Overpassed Deadline', digits=(16, 2), readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'deadline': fields.date("Deadline", readonly=True),
'request_id': fields.many2one('survey.request', 'Request_id', readonly=True),
'request_id': fields.many2one('survey.user_input', 'Request_id', readonly=True),
'closed': fields.date("closed", readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'),
('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), ('09', 'September'),
('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'plan_id': fields.many2one('hr_evaluation.plan', 'Plan', readonly=True),
'employee_id': fields.many2one('hr.employee', "Employee", readonly=True),
'rating': fields.selection([
('0','Significantly bellow expectations'),
('1','Did not meet expectations'),
('2','Meet expectations'),
('3','Exceeds expectations'),
('4','Significantly exceeds expectations'),
('0', 'Significantly bellow expectations'),
('1', 'Did not meet expectations'),
('2', 'Meet expectations'),
('3', 'Exceeds expectations'),
('4', 'Significantly exceeds expectations'),
], "Overall Rating", readonly=True),
'nbr':fields.integer('# of Requests', readonly=True),
'nbr': fields.integer('# of Requests', readonly=True),
'state': fields.selection([
('draft','Draft'),
('wait','Plan In Progress'),
('progress','Final Validation'),
('done','Done'),
('cancel','Cancelled'),
], 'Status',readonly=True),
('draft', 'Draft'),
('wait', 'Plan In Progress'),
('progress', 'Final Validation'),
('done', 'Done'),
('cancel', 'Cancelled'),
], 'Status', readonly=True),
}
_order = 'create_date desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'hr_evaluation_report')
cr.execute("""

View File

@ -6,37 +6,20 @@ access_hr_evaluation_plan_phase_user,hr_evaluation.plan.phase.user,model_hr_eval
access_hr_evaluation_interview_user,hr.evaluation.interview.user,model_hr_evaluation_interview,base.group_hr_user,1,1,1,1
access_hr_evaluation_interview_employee,hr.evaluation.interview.employee,model_hr_evaluation_interview,base.group_user,1,1,1,0
access_hr_evaluation_report,hr.evaluation.report,model_hr_evaluation_report,base.group_hr_manager,1,1,1,1
access_survey_type_hr_manager,survey.type,survey.model_survey_type,base.group_hr_manager,1,1,1,1
access_survey_hr_manager,survey.hr.manager,survey.model_survey,base.group_hr_manager,1,1,1,1
access_survey_history_manager,survey.history,survey.model_survey_history,base.group_hr_manager,1,1,1,1
access_survey_hr_manager,survey.hr.manager,survey.model_survey_survey,base.group_hr_manager,1,1,1,1
access_survey_question_hr_manager,survey.question,survey.model_survey_question,base.group_hr_manager,1,1,1,1
access_survey_question_column_heading_hr_manager,survey.question.column.heading,survey.model_survey_question_column_heading,base.group_hr_manager,1,1,1,1
access_survey_answer_hr_manager,survey.answer,survey.model_survey_answer,base.group_hr_manager,1,1,1,1
access_survey_response_hr_manager,survey.response,survey.model_survey_response,base.group_hr_manager,1,1,1,1
access_survey_response_line_hr_manager,survey.response.line,survey.model_survey_response_line,base.group_hr_manager,1,1,1,1
access_survey_tbl_column_heading_hr_manager,survey.tbl.column.heading,survey.model_survey_tbl_column_heading,base.group_hr_manager,1,1,1,1
access_survey_response_answer_hr_manager,survey.response.answer,survey.model_survey_response_answer,base.group_hr_manager,1,1,1,1
access_survey_request_hr_manager,survey.request,survey.model_survey_request,base.group_hr_manager,1,1,1,1
access_survey_answer_hr_user,survey.answer.hr.user,survey.model_survey_answer,base.group_hr_user,1,1,1,0
access_survey_response_answer_hr_user,survey.response.answer.hr.user,survey.model_survey_response_answer,base.group_hr_user,1,1,1,0
access_survey_type_hr_user,survey.type.hr.user,survey.model_survey_type,base.group_hr_user,1,1,1,0
access_survey_question_column_heading_hr_manager,survey.question.column.heading,survey.model_survey_label,base.group_hr_manager,1,1,1,1
access_survey_response_hr_manager,survey.response,survey.model_survey_user_input,base.group_hr_manager,1,1,1,1
access_survey_response_line_hr_manager,survey.response.line,survey.model_survey_user_input_line,base.group_hr_manager,1,1,1,1
access_survey_question_hr_user,survey.question.hr.user,survey.model_survey_question,base.group_hr_user,1,1,1,0
access_survey_page_hr_user,survey.page.hr.user,survey.model_survey_page,base.group_hr_user,1,1,1,1
access_survey_response_hr_user,survey.response.hr.user,survey.model_survey_response,base.group_hr_user,1,1,1,0
access_survey_history_hr_user,survey.history.hr.user,survey.model_survey_history,base.group_hr_user,1,1,1,0
access_survey_request_hr_user,survey.request.hr.user,survey.model_survey_request,base.group_hr_user,1,1,1,0
access_survey_question_column_heading_hr_user,survey.question.column.heading.hr.user,survey.model_survey_question_column_heading,base.group_hr_user,1,1,1,0
access_survey_response_line_hr_user,survey.response.line.hr.user,survey.model_survey_response_line,base.group_hr_user,1,1,1,0
access_survey_tbl_column_heading_hr_user,survey.tbl.column.heading.hr.user,survey.model_survey_tbl_column_heading,base.group_hr_user,1,1,1,0
access_survey_response_hr_user,survey.response.hr.user,survey.model_survey_user_input,base.group_hr_user,1,1,1,0
access_survey_question_column_heading_hr_user,survey.question.column.heading.hr.user,survey.model_survey_label,base.group_hr_user,1,1,1,0
access_survey_response_line_hr_user,survey.response.line.hr.user,survey.model_survey_user_input_line,base.group_hr_user,1,1,1,0
access_calendar_attendee_survey_user,base.calendar.calendar.attendee.survey.user,calendar.model_calendar_attendee,base.group_survey_user,1,1,1,0
access_calendar_attendee_tool_user,base.calendar.calendar.attendee.tool.user,calendar.model_calendar_attendee,base.group_tool_user,1,1,1,0
access_survey_request_hr_employee,survey.request.hr.employee,survey.model_survey_request,base.group_user,1,1,1,0
access_survey_hr_employee,survey.hr.employee,survey.model_survey,base.group_user,1,1,0,0
access_survey_hr_employee,survey.hr.employee,survey.model_survey_survey,base.group_user,1,1,0,0
access_survey_page_hr_employee,survey.page.hr.employee,survey.model_survey_page,base.group_user,1,0,0,0
access_survey_answer_hr_employee,survey.answer.employee,survey.model_survey_answer,base.group_user,1,0,0,0
access_survey_question_hr_employee,survey.question.employee,survey.model_survey_question,base.group_user,1,0,0,0
access_survey_response_hr_employee,survey.response.employee,survey.model_survey_response,base.group_user,1,1,1,0
access_survey_question_column_heading_hr_employee,survey.question.column.heading.employee,survey.model_survey_question_column_heading,base.group_user,1,0,0,0
access_survey_response_line_hr_employee,survey.response.line.employee,survey.model_survey_response_line,base.group_user,1,1,1,0
access_survey_response_answer_hr_employee,survey.response.answer.hr.employee,survey.model_survey_response_answer,base.group_user,1,1,1,0
access_survey_tbl_column_heading_hr_employee,survey.tbl.column.heading,survey.model_survey_tbl_column_heading,base.group_user,1,1,1,0
access_survey_response_hr_employee,survey.response.employee,survey.model_survey_user_input,base.group_user,1,1,1,0
access_survey_question_column_heading_hr_employee,survey.question.column.heading.employee,survey.model_survey_label,base.group_user,1,0,0,0
access_survey_response_line_hr_employee,survey.response.line.employee,survey.model_survey_user_input_line,base.group_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_hr_evaluation_interview_user hr.evaluation.interview.user model_hr_evaluation_interview base.group_hr_user 1 1 1 1
7 access_hr_evaluation_interview_employee hr.evaluation.interview.employee model_hr_evaluation_interview base.group_user 1 1 1 0
8 access_hr_evaluation_report hr.evaluation.report model_hr_evaluation_report base.group_hr_manager 1 1 1 1
9 access_survey_type_hr_manager access_survey_hr_manager survey.type survey.hr.manager survey.model_survey_type survey.model_survey_survey base.group_hr_manager 1 1 1 1
access_survey_hr_manager survey.hr.manager survey.model_survey base.group_hr_manager 1 1 1 1
access_survey_history_manager survey.history survey.model_survey_history base.group_hr_manager 1 1 1 1
10 access_survey_question_hr_manager survey.question survey.model_survey_question base.group_hr_manager 1 1 1 1
11 access_survey_question_column_heading_hr_manager survey.question.column.heading survey.model_survey_question_column_heading survey.model_survey_label base.group_hr_manager 1 1 1 1
12 access_survey_answer_hr_manager access_survey_response_hr_manager survey.answer survey.response survey.model_survey_answer survey.model_survey_user_input base.group_hr_manager 1 1 1 1
13 access_survey_response_hr_manager access_survey_response_line_hr_manager survey.response survey.response.line survey.model_survey_response survey.model_survey_user_input_line base.group_hr_manager 1 1 1 1
access_survey_response_line_hr_manager survey.response.line survey.model_survey_response_line base.group_hr_manager 1 1 1 1
access_survey_tbl_column_heading_hr_manager survey.tbl.column.heading survey.model_survey_tbl_column_heading base.group_hr_manager 1 1 1 1
access_survey_response_answer_hr_manager survey.response.answer survey.model_survey_response_answer base.group_hr_manager 1 1 1 1
access_survey_request_hr_manager survey.request survey.model_survey_request base.group_hr_manager 1 1 1 1
access_survey_answer_hr_user survey.answer.hr.user survey.model_survey_answer base.group_hr_user 1 1 1 0
access_survey_response_answer_hr_user survey.response.answer.hr.user survey.model_survey_response_answer base.group_hr_user 1 1 1 0
access_survey_type_hr_user survey.type.hr.user survey.model_survey_type base.group_hr_user 1 1 1 0
14 access_survey_question_hr_user survey.question.hr.user survey.model_survey_question base.group_hr_user 1 1 1 0
15 access_survey_page_hr_user survey.page.hr.user survey.model_survey_page base.group_hr_user 1 1 1 1
16 access_survey_response_hr_user survey.response.hr.user survey.model_survey_response survey.model_survey_user_input base.group_hr_user 1 1 1 0
17 access_survey_history_hr_user access_survey_question_column_heading_hr_user survey.history.hr.user survey.question.column.heading.hr.user survey.model_survey_history survey.model_survey_label base.group_hr_user 1 1 1 0
18 access_survey_request_hr_user access_survey_response_line_hr_user survey.request.hr.user survey.response.line.hr.user survey.model_survey_request survey.model_survey_user_input_line base.group_hr_user 1 1 1 0
access_survey_question_column_heading_hr_user survey.question.column.heading.hr.user survey.model_survey_question_column_heading base.group_hr_user 1 1 1 0
access_survey_response_line_hr_user survey.response.line.hr.user survey.model_survey_response_line base.group_hr_user 1 1 1 0
access_survey_tbl_column_heading_hr_user survey.tbl.column.heading.hr.user survey.model_survey_tbl_column_heading base.group_hr_user 1 1 1 0
19 access_calendar_attendee_survey_user base.calendar.calendar.attendee.survey.user calendar.model_calendar_attendee base.group_survey_user 1 1 1 0
20 access_calendar_attendee_tool_user access_survey_hr_employee base.calendar.calendar.attendee.tool.user survey.hr.employee calendar.model_calendar_attendee survey.model_survey_survey base.group_tool_user base.group_user 1 1 1 0 0
access_survey_request_hr_employee survey.request.hr.employee survey.model_survey_request base.group_user 1 1 1 0
access_survey_hr_employee survey.hr.employee survey.model_survey base.group_user 1 1 0 0
21 access_survey_page_hr_employee survey.page.hr.employee survey.model_survey_page base.group_user 1 0 0 0
access_survey_answer_hr_employee survey.answer.employee survey.model_survey_answer base.group_user 1 0 0 0
22 access_survey_question_hr_employee survey.question.employee survey.model_survey_question base.group_user 1 0 0 0
23 access_survey_response_hr_employee survey.response.employee survey.model_survey_response survey.model_survey_user_input base.group_user 1 1 1 0
24 access_survey_question_column_heading_hr_employee survey.question.column.heading.employee survey.model_survey_question_column_heading survey.model_survey_label base.group_user 1 0 0 0
25 access_survey_response_line_hr_employee survey.response.line.employee survey.model_survey_response_line survey.model_survey_user_input_line base.group_user 1 1 1 0
access_survey_response_answer_hr_employee survey.response.answer.hr.employee survey.model_survey_response_answer base.group_user 1 1 1 0
access_survey_tbl_column_heading_hr_employee survey.tbl.column.heading survey.model_survey_tbl_column_heading base.group_user 1 1 1 0

View File

@ -0,0 +1,676 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Appraisal form -->
<record model="survey.survey" id="appraisal_form">
<field name="title">Employee Appraisal Form</field>
<field name="stage_id" ref="survey.stage_permanent" />
<field name="res_model">hr_evaluation</field>
<field name="auth_required" eval="True" />
<field name="users_can_go_back" eval="True" />
<field name="description">&lt;p&gt; &lt;/p&gt;</field>
<field name="thank_you_message">&lt;p&gt; &lt;/p&gt;</field>
</record>
<!-- Page 1 -->
<record model="survey.page" id="appraisal_1">
<field name="title">Employee Appraisal Form</field>
<field name="survey_id" ref="appraisal_form" />
<field name="sequence">1</field>
<field name="description">&lt;h2&gt;Overall Purpose Of Employee Appraisal&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;To initiate a clear and open communication of performance expectations
&lt;li&gt;To assist employees in their professional growth, through the identification of strengths and opportunities for
development&lt;/ul&gt;
&lt;h2&gt;At the outset of the appraisal time period&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;It is the joint responsibility of the employee and the supervisor (appraiser) to establish a feasible work plan for the
coming year, including major employee responsibilities and corresponding benchmarks against which results will be
evaluated.
&lt;li&gt;Critical or key elements of performance and professional development needs (if any), should also be noted at this time&lt;/ul&gt;
&lt;h2&gt;At the conclusion of the appraisal time period&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;The employee will be responsible for completing a draft of the Appraisal Form as a tool for self-appraisal and a starting
point for the supervisors evaluation. The employee can add examples of achievements for each criterion.
Once the form had been filled, the employee send it to his supervisor.
&lt;li&gt;It is the primary responsibility of the supervisor to gather the necessary input from the appropriate sources of feedback
(internal and/or external customers, peers). In case of collaboration with OpenERP SA Belgium, the supervisor must
receive completed evaluation form from the employee's Belgian project manager.
&lt;li&gt;The supervisor synthesizes and integrates all input into the completed appraisal. He motivates his evaluation in the ad
hoc fields.
&lt;li&gt;The employee may choose to offer comments or explanation regarding the completed review.
&lt;li&gt;The supervisor send the form to the HR department in India and in Belgium&lt;/ul&gt;</field>
</record>
<record model="survey.question" id="appraisal_1_1">
<field name="page_id" ref="appraisal_1" />
<field name="sequence">1</field>
<field name="question">Name</field>
<field name="type">textbox</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="appraisal_1_2">
<field name="page_id" ref="appraisal_1" />
<field name="sequence">2</field>
<field name="question">Position Title</field>
<field name="type">textbox</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="appraisal_1_3">
<field name="page_id" ref="appraisal_1" />
<field name="sequence">3</field>
<field name="question">Appraisal for Period</field>
<field name="type">textbox</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="appraisal_1_4">
<field name="page_id" ref="appraisal_1" />
<field name="sequence">4</field>
<field name="question">Date of review</field>
<field name="type">textbox</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="appraisal_1_5">
<field name="page_id" ref="appraisal_1" />
<field name="sequence">5</field>
<field name="question">Appraiser</field>
<field name="type">textbox</field>
<field name="constr_mandatory" eval="True" />
</record>
<!-- Page 2 -->
<record model="survey.page" id="appraisal_2">
<field name="title">Work Plan</field>
<field name="survey_id" ref="appraisal_form" />
<field name="sequence">2</field>
<field name="description">&lt;p&gt; &lt;/p&gt;</field>
</record>
<record model="survey.question" id="appraisal_2_1">
<field name="page_id" ref="appraisal_2" />
<field name="sequence">1</field>
<field name="question">Objectives</field>
<field name="type">free_text</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="appraisal_2_2">
<field name="page_id" ref="appraisal_2" />
<field name="sequence">2</field>
<field name="question">Results</field>
<field name="type">free_text</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="appraisal_2_3">
<field name="page_id" ref="appraisal_2" />
<field name="sequence">3</field>
<field name="question">Additional Comments</field>
<field name="type">free_text</field>
</record>
<!-- Page 3 -->
<record model="survey.page" id="appraisal_3">
<field name="title">Employee Performance in Key Areas</field>
<field name="survey_id" ref="appraisal_form" />
<field name="sequence">3</field>
<field name="description">The appraiser should rate the employees major work accomplishments and performance according to the metric provided
below:&lt;ol&gt;
&lt;li&gt; Significantly exceeds standards and expectations required of the position
&lt;li&gt; Exceeds standards and expectations
&lt;li&gt; Meet standards and expectations
&lt;li&gt; Did not meet standards and expectations
&lt;li&gt; Significantly below standards and expectations&lt;/ol&gt;</field>
</record>
<record model="survey.question" id="appraisal_3_1">
<field name="page_id" ref="appraisal_3" />
<field name="sequence">1</field>
<field name="question">Subject</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="acol_3_1_1">
<field name="question_id" ref="appraisal_3_1"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="acol_3_1_2">
<field name="question_id" ref="appraisal_3_1"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="acol_3_1_3">
<field name="question_id" ref="appraisal_3_1"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="acol_3_1_4">
<field name="question_id" ref="appraisal_3_1"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="acol_3_1_5">
<field name="question_id" ref="appraisal_3_1"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="arow_3_1_1">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">1</field>
<field name="value">Ability to cope with multidisciplinarity of team</field>
</record>
<record model="survey.label" id="arow_3_1_2">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">2</field>
<field name="value">Enthusiasm &amp; implication toward projects/assignments</field>
</record>
<record model="survey.label" id="arow_3_1_3">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">3</field>
<field name="value">Compliance to internal rules and processes (timesheets completion, etc.)</field>
</record>
<record model="survey.label" id="arow_3_1_4">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">4</field>
<field name="value">Team spirit: ability to work efficiently with peers, manage the conflicts with diplomacy</field>
</record>
<record model="survey.label" id="arow_3_1_5">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">5</field>
<field name="value">Initiative and self autonomy</field>
</record>
<record model="survey.label" id="arow_3_1_6">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">6</field>
<field name="value">Ability to follow and complete work as instructed</field>
</record>
<record model="survey.label" id="arow_3_1_7">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">7</field>
<field name="value">Decision making</field>
</record>
<record model="survey.label" id="arow_3_1_8">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">8</field>
<field name="value">Customer commitment</field>
</record>
<record model="survey.label" id="arow_3_1_9">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">9</field>
<field name="value">Communication skills (written &amp; verbally): clearness, concision, exactitude</field>
</record>
<record model="survey.label" id="arow_3_1_10">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">10</field>
<field name="value">Technical skills regarding to the job requirements</field>
</record>
<record model="survey.label" id="arow_3_1_11">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">11</field>
<field name="value">Analytical and synthetic mind</field>
</record>
<record model="survey.label" id="arow_3_1_12">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">12</field>
<field name="value">Promptness and attendance record</field>
</record>
<record model="survey.label" id="arow_3_1_13">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">13</field>
<field name="value">Adaptability: Ability to adapt oneself to organizational changes while keeping efficiency</field>
</record>
<record model="survey.label" id="arow_3_1_14">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">14</field>
<field name="value">Creativity and forward looking aptitude</field>
</record>
<record model="survey.label" id="arow_3_1_15">
<field name="question_id_2" ref="appraisal_3_1"/>
<field name="sequence">15</field>
<field name="value">Time management: projects/tasks are completed on time</field>
</record>
<record model="survey.question" id="appraisal_3_2">
<field name="page_id" ref="appraisal_3" />
<field name="sequence">2</field>
<field name="question">Supervisors only</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="acol_3_2_1">
<field name="question_id" ref="appraisal_3_2"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="acol_3_2_2">
<field name="question_id" ref="appraisal_3_2"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="acol_3_2_3">
<field name="question_id" ref="appraisal_3_2"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="acol_3_2_4">
<field name="question_id" ref="appraisal_3_2"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="acol_3_2_5">
<field name="question_id" ref="appraisal_3_2"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="arow_3_2_1">
<field name="question_id_2" ref="appraisal_3_2"/>
<field name="sequence">1</field>
<field name="value">Results of the bottom-up survey and mitigation actions to face technical, organizational, structural and/or relational issues</field>
</record>
<record model="survey.label" id="arow_3_2_2">
<field name="question_id_2" ref="appraisal_3_2"/>
<field name="sequence">2</field>
<field name="value">Delegation: Ability to efficiently assign tasks to other people</field>
</record>
<record model="survey.label" id="arow_3_2_3">
<field name="question_id_2" ref="appraisal_3_2"/>
<field name="sequence">3</field>
<field name="value">Leadership: create a challenging and motivating work environment aligned with the company's strategy</field>
</record>
<record model="survey.label" id="arow_3_2_4">
<field name="question_id_2" ref="appraisal_3_2"/>
<field name="sequence">4</field>
<field name="value">Leadership: sustain subordinates in their professional growth</field>
</record>
<record model="survey.label" id="arow_3_2_5">
<field name="question_id_2" ref="appraisal_3_2"/>
<field name="sequence">5</field>
<field name="value">Ability to manage planning resources, risks, budgets and deadlines</field>
</record>
<!-- Page 4 -->
<record model="survey.page" id="appraisal_4">
<field name="title">Professional Development and Performance Plan</field>
<field name="survey_id" ref="appraisal_form" />
<field name="sequence">4</field>
<field name="description">&lt;p&gt;Identify professional, performance, or project objectives you recommend for employees continued career development
over the coming year.&lt;/p&gt;</field>
</record>
<record model="survey.question" id="appraisal_4_1">
<field name="page_id" ref="appraisal_4" />
<field name="sequence">1</field>
<field name="question">Professional Development Objectives</field>
<field name="type">free_text</field>
</record>
<record model="survey.question" id="appraisal_4_2">
<field name="page_id" ref="appraisal_4" />
<field name="sequence">2</field>
<field name="question">Personal Performance Objectives</field>
<field name="type">free_text</field>
</record>
<record model="survey.question" id="appraisal_4_3">
<field name="page_id" ref="appraisal_4" />
<field name="sequence">3</field>
<field name="question">Project Objectives</field>
<field name="type">free_text</field>
</record>
<!-- Page 5 -->
<record model="survey.page" id="appraisal_5">
<field name="title">Employee Comments</field>
<field name="survey_id" ref="appraisal_form" />
<field name="description">&lt;p&gt;&lt;/p&gt;</field>
<field name="sequence">5</field>
</record>
<record model="survey.question" id="appraisal_5_1">
<field name="page_id" ref="appraisal_5" />
<field name="sequence">1</field>
<field name="question">Use the following space to make any comments regarding the above performance evaluation.</field>
<field name="type">free_text</field>
</record>
<!-- Employee Opinion form -->
<record model="survey.survey" id="opinion_form">
<field name="title">Employee Opinion Form</field>
<field name="stage_id" ref="survey.stage_permanent" />
<field name="res_model">hr_evaluation</field>
<field name="auth_required" eval="True" />
<field name="users_can_go_back" eval="True" />
<field name="description">&lt;p&gt; &lt;/p&gt;</field>
<field name="thank_you_message">&lt;p&gt; &lt;/p&gt;</field>
</record>
<!-- Page 1 -->
<record model="survey.page" id="opinion_1">
<field name="title">Appraisal Process</field>
<field name="survey_id" ref="opinion_form" />
<field name="sequence">1</field>
<field name="description">&lt;h2&gt;At the supervisor's appraisal date&lt;/h2&gt;
&lt;p&gt;His direct reports will be invited through OpenERP to express a feedback on their supervisor's leadership and to give their opinion about their own engagement and effectiveness, the continuous improvement and openness in action in thecompany...&lt;/p&gt;
&lt;p&gt;The employees will send back their anonymous answers to OpenERP. The data will be handled by the HR manager and a brief summary of the data will be sent to the concerned supervisor, to his team and to the supervisor's supervisor.&lt;/p&gt;
&lt;p&gt;The appraiser should rate the employee's major work accomplishments and performance according to the metric provided below
&lt;ol&gt;
&lt;li&gt;Significantly exceeds standards and expectations required of the position&lt;/li&gt;
&lt;li&gt;Exceeds standards and expectations&lt;/li&gt;
&lt;li&gt;Meet standards and expectations&lt;/li&gt;
&lt;li&gt;Did not meet standards and expectations&lt;/li&gt;
&lt;li&gt;Significantly below standards and expectations&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;</field>
</record>
<record model="survey.question" id="opinion_1_1">
<field name="page_id" ref="opinion_1" />
<field name="sequence">1</field>
<field name="question">Name of your direct supervisor</field>
<field name="type">textbox</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="opinion_1_2">
<field name="page_id" ref="opinion_1" />
<field name="sequence">2</field>
<field name="question">Date</field>
<field name="type">textbox</field>
<field name="constr_mandatory" eval="True" />
</record>
<!-- Page 2 -->
<record model="survey.page" id="opinion_2">
<field name="title">Evaluation</field>
<field name="survey_id" ref="opinion_form" />
<field name="sequence">2</field>
<field name="description">&lt;p&gt; &lt;/p&gt;</field>
</record>
<record model="survey.question" id="opinion_2_1">
<field name="page_id" ref="opinion_2" />
<field name="sequence">1</field>
<field name="question">Engagement</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="opcol_2_1_1">
<field name="question_id" ref="opinion_2_1"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="opcol_2_1_2">
<field name="question_id" ref="opinion_2_1"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="opcol_2_1_3">
<field name="question_id" ref="opinion_2_1"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="opcol_2_1_4">
<field name="question_id" ref="opinion_2_1"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="opcol_2_1_5">
<field name="question_id" ref="opinion_2_1"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="oprow_2_1_1">
<field name="question_id_2" ref="opinion_2_1"/>
<field name="sequence">1</field>
<field name="value">I am proud to tell others I work here</field>
</record>
<record model="survey.label" id="oprow_2_1_2">
<field name="question_id_2" ref="opinion_2_1"/>
<field name="sequence">2</field>
<field name="value">My job provides me with a sense of personal accomplishment</field>
</record>
<record model="survey.label" id="oprow_2_1_3">
<field name="question_id_2" ref="opinion_2_1"/>
<field name="sequence">3</field>
<field name="value">I would prefer to remain with this company even if a comparable job were available in another company</field>
</record>
<record model="survey.label" id="oprow_2_1_4">
<field name="question_id_2" ref="opinion_2_1"/>
<field name="sequence">4</field>
<field name="value">Taking everything into account, how satisfied are you with your current job?</field>
</record>
<record model="survey.label" id="oprow_2_1_5">
<field name="question_id_2" ref="opinion_2_1"/>
<field name="sequence">5</field>
<field name="value">I am willing to put in a great deal of effort beyond what is expected to help my workgroup succeed</field>
</record>
<record model="survey.question" id="opinion_2_2">
<field name="page_id" ref="opinion_2" />
<field name="sequence">2</field>
<field name="question">Leadership</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="opcol_2_2_1">
<field name="question_id" ref="opinion_2_2"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="opcol_2_2_2">
<field name="question_id" ref="opinion_2_2"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="opcol_2_2_3">
<field name="question_id" ref="opinion_2_2"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="opcol_2_2_4">
<field name="question_id" ref="opinion_2_2"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="opcol_2_2_5">
<field name="question_id" ref="opinion_2_2"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="oprow_2_2_1">
<field name="question_id_2" ref="opinion_2_2"/>
<field name="sequence">1</field>
<field name="value">Demonstrates genuine concern for me as a person</field>
</record>
<record model="survey.label" id="oprow_2_2_2">
<field name="question_id_2" ref="opinion_2_2"/>
<field name="sequence">2</field>
<field name="value">I consistently acquire new knowledge, skills or understanding through contact with my supervisor. He helps me growing my compete</field>
</record>
<record model="survey.label" id="oprow_2_2_3">
<field name="question_id_2" ref="opinion_2_2"/>
<field name="sequence">3</field>
<field name="value">Listens and takes into account all ideas and do his best to put in place the best of these</field>
</record>
<record model="survey.label" id="oprow_2_2_4">
<field name="question_id_2" ref="opinion_2_2"/>
<field name="sequence">4</field>
<field name="value">I believe the information that I get from the person I report to.</field>
</record>
<record model="survey.question" id="opinion_2_3">
<field name="page_id" ref="opinion_2" />
<field name="sequence">3</field>
<field name="question">Effectiveness</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="opcol_2_3_1">
<field name="question_id" ref="opinion_2_3"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="opcol_2_3_2">
<field name="question_id" ref="opinion_2_3"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="opcol_2_3_3">
<field name="question_id" ref="opinion_2_3"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="opcol_2_3_4">
<field name="question_id" ref="opinion_2_3"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="opcol_2_3_5">
<field name="question_id" ref="opinion_2_3"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="oprow_2_3_1">
<field name="question_id_2" ref="opinion_2_3"/>
<field name="sequence">1</field>
<field name="value">I'm efficient at work and my achievements are successful</field>
</record>
<record model="survey.label" id="oprow_2_3_2">
<field name="question_id_2" ref="opinion_2_3"/>
<field name="sequence">2</field>
<field name="value">I have enough work</field>
</record>
<record model="survey.label" id="oprow_2_3_3">
<field name="question_id_2" ref="opinion_2_3"/>
<field name="sequence">3</field>
<field name="value">I mostly work on value-added tasks for the company, the products or the services</field>
</record>
<record model="survey.question" id="opinion_2_4">
<field name="page_id" ref="opinion_2" />
<field name="sequence">4</field>
<field name="question">Continuous Improvement</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="opcol_2_4_1">
<field name="question_id" ref="opinion_2_4"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="opcol_2_4_2">
<field name="question_id" ref="opinion_2_4"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="opcol_2_4_3">
<field name="question_id" ref="opinion_2_4"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="opcol_2_4_4">
<field name="question_id" ref="opinion_2_4"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="opcol_2_4_5">
<field name="question_id" ref="opinion_2_4"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="oprow_2_4_1">
<field name="question_id_2" ref="opinion_2_4"/>
<field name="sequence">1</field>
<field name="value">My work contributes towards the continuous improvement of the company, our services or products</field>
</record>
<record model="survey.label" id="oprow_2_4_2">
<field name="question_id_2" ref="opinion_2_4"/>
<field name="sequence">2</field>
<field name="value">What I did several months ago is still of use to the company, the services or the products today</field>
</record>
<record model="survey.label" id="oprow_2_4_3">
<field name="question_id_2" ref="opinion_2_4"/>
<field name="sequence">3</field>
<field name="value">Overall, I believe the quality of products and/or services my workgroup delivers is improving</field>
</record>
<record model="survey.label" id="oprow_2_4_4">
<field name="question_id_2" ref="opinion_2_4"/>
<field name="sequence">4</field>
<field name="value">Our workgroup identifies and reduces waste of time in our activities and processes</field>
</record>
<record model="survey.question" id="opinion_2_5">
<field name="page_id" ref="opinion_2" />
<field name="sequence">5</field>
<field name="question">Openness</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="opcol_2_5_1">
<field name="question_id" ref="opinion_2_5"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="opcol_2_5_2">
<field name="question_id" ref="opinion_2_5"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="opcol_2_5_3">
<field name="question_id" ref="opinion_2_5"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="opcol_2_5_4">
<field name="question_id" ref="opinion_2_5"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="opcol_2_5_5">
<field name="question_id" ref="opinion_2_5"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="oprow_2_5_1">
<field name="question_id_2" ref="opinion_2_5"/>
<field name="sequence">1</field>
<field name="value">I know the company's values and live them</field>
</record>
<record model="survey.label" id="oprow_2_5_2">
<field name="question_id_2" ref="opinion_2_5"/>
<field name="sequence">2</field>
<field name="value">My best achievements have been communicated to the community, internally or to customers</field>
</record>
<record model="survey.question" id="opinion_2_6">
<field name="page_id" ref="opinion_2" />
<field name="sequence">6</field>
<field name="question">Miscellaneous</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="opcol_2_6_1">
<field name="question_id" ref="opinion_2_6"/>
<field name="sequence">1</field>
<field name="value">1</field>
</record>
<record model="survey.label" id="opcol_2_6_2">
<field name="question_id" ref="opinion_2_6"/>
<field name="sequence">2</field>
<field name="value">2</field>
</record>
<record model="survey.label" id="opcol_2_6_3">
<field name="question_id" ref="opinion_2_6"/>
<field name="sequence">3</field>
<field name="value">3</field>
</record>
<record model="survey.label" id="opcol_2_6_4">
<field name="question_id" ref="opinion_2_6"/>
<field name="sequence">4</field>
<field name="value">4</field>
</record>
<record model="survey.label" id="opcol_2_6_5">
<field name="question_id" ref="opinion_2_6"/>
<field name="sequence">5</field>
<field name="value">5</field>
</record>
<record model="survey.label" id="oprow_2_6_1">
<field name="question_id_2" ref="opinion_2_6"/>
<field name="sequence">1</field>
<field name="value">Actions by Executive management show genuine interest in the well-being of employees</field>
</record>
<record model="survey.label" id="oprow_2_6_2">
<field name="question_id_2" ref="opinion_2_6"/>
<field name="sequence">2</field>
<field name="value">I have the same opportunity to succeed as others with similar experiences, performance and educational background</field>
</record>
<record model="survey.label" id="oprow_2_6_3">
<field name="question_id_2" ref="opinion_2_6"/>
<field name="sequence">3</field>
<field name="value">Compared to similar jobs in other companies where I could work, my total compensation...</field>
</record>
<record model="survey.label" id="oprow_2_6_4">
<field name="question_id_2" ref="opinion_2_6"/>
<field name="sequence">4</field>
<field name="value">I understand the company strategy and how my workgroup supports it</field>
</record>
<record model="survey.question" id="opinion_2_7">
<field name="page_id" ref="opinion_2" />
<field name="sequence">7</field>
<field name="question">Additional comments</field>
<field name="type">free_text</field>
</record>
</data>
</openerp>

View File

@ -1,6 +1,6 @@
-
!record {model: hr.employee, id: hr.employee_fp, view: False}:
evaluation_plan_id: hr_evaluation_plan_managersevaluationplan0
-
!record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, view: False}:
plan_id: hr_evaluation.hr_evaluation_plan_managersevaluationplan0
# -
# !record {model: hr.employee, id: hr.employee_fp, view: False}:
# evaluation_plan_id: hr_evaluation_plan_managersevaluationplan0
# -
# !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, view: False}:
# plan_id: hr_evaluation.hr_evaluation_plan_managersevaluationplan0

View File

@ -1,108 +1,103 @@
-
I set the "Employee Evaluation" survey in open state.
-
!python {model: survey}: |
self.survey_open(cr, uid, [ref("survey_2")], context)
-
I check that state of "Employee Evaluation" survey is Open.
-
!assert {model: survey, id: survey_2, severity: error, string: Survey should be in OPen state}:
- state == 'open'
-
I start the evaluation process by click on "Start Evaluation" button.
-
!python {model: hr_evaluation.evaluation}: |
self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
-
I check that state is "Plan in progress".
-
!assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be 'Plan in progress' state}:
- state == 'wait'
-
I find a mistake on evaluation form. So I cancel the evaluation and again start it.
-
!python {model: hr_evaluation.evaluation}: |
evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
self.button_cancel(cr, uid, [ref('hr_evaluation_evaluation_0')])
assert evaluation.state == 'cancel', 'Evaluation should be in cancel state'
self.button_draft(cr, uid, [ref('hr_evaluation_evaluation_0')])
evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
assert evaluation.state == 'draft', 'Evaluation should be in draft state'
self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
-
I check that state is "Plan in progress" and "Interview Request" record is created
-
!python {model: hr_evaluation.evaluation}: |
interview_obj = self.pool.get('hr.evaluation.interview')
evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
assert evaluation.state == 'wait', "Evaluation should be 'Plan in progress' state"
interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
assert len(interview_ids), "Interview evaluation survey not created"
-
Give answer of the first page in "Employee Evaluation" survey.
-
!python {model: survey.question.wiz}: |
name_wiz_obj=self.pool.get('survey.name.wiz')
interview_obj = self.pool.get('hr.evaluation.interview')
interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
assert len(interview_ids), "Interview evaluation survey not created"
ctx = {'active_model':'hr.evaluation.interview', 'active_id': interview_ids[0], 'active_ids': [interview_ids], 'survey_id': ref("survey_2")}
name_id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_2")})
ctx ["sur_name_id"] = name_id
self.create(cr, uid, {str(ref("survey_question_2")) +"_" +str(ref("survey_answer_1")) + "_multi" :'tpa',
str(ref("survey_question_2")) +"_" +str(ref("survey_answer_10")) + "_multi" :'application eng',
str(ref("survey_question_2")) +"_" +str(ref("survey_answer_20")) + "_multi" :'3',
str(ref("survey_question_2")) +"_" +str(ref("survey_answer_25")) + "_multi" :'2011-12-02 16:42:00',
str(ref("survey_question_2")) +"_" +str(ref("survey_answer_43")) + "_multi" :'HR',
}, context = ctx)
-
I close this Evaluation survey by giving answer of questions.
-
!python {model: hr_evaluation.evaluation}: |
interview_obj = self.pool.get('hr.evaluation.interview')
evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
interview_obj.survey_req_done(cr, uid, [r.id for r in evaluation.survey_request_ids])
for survey in evaluation.survey_request_ids:
interview = interview_obj.browse(cr, uid, survey.id, context)
assert interview.state == "done", 'survey must be in done state'
-
I print the evaluation.
-
!python {model: hr_evaluation.evaluation}: |
evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
self.pool.get('hr.evaluation.interview').action_print_survey(cr, uid, [r.id for r in evaluation.survey_request_ids])
-
I click on "Final Validation" button to finalise evaluation.
-
!python {model: hr_evaluation.evaluation}: |
self.button_final_validation(cr, uid, [ref("hr_evaluation_evaluation_0")])
-
I check that state is "Waiting Appreciation".
-
!assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
- state == 'progress'
-
Give Rating "Meet expectations" by selecting overall Rating.
-
!record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
rating: '2'
-
I close this Evaluation by click on "Done" button of this wizard.
-
!python {model: hr_evaluation.evaluation}: |
self.button_done(cr, uid, [ref("hr_evaluation_evaluation_0")])
-
I check that state of Evaluation is done.
-
!assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be in done state}:
- state == 'done'
-
Print Evaluations Statistics Report
-
!python {model: hr.evaluation.report}: |
import os, time
from openerp import tools
ctx={}
data_dict={'state': 'done', 'rating': 2, 'employee_id': ref("hr.employee_fp")}
from openerp.tools import test_reports
test_reports.try_report_action(cr, uid, 'hr_evaluation_evaluation_0',wiz_data=data_dict, context=ctx, our_module='hr_evaluation')
# -
# I check that state of "Employee Evaluation" survey is Open.
# -
# !assert {model: survey.survey, id: appraisal_form, severity: error, string: Survey should be in 'open' state}:
# - state == 'open'
# -
# I start the evaluation process by click on "Start Evaluation" button.
# -
# !python {model: hr_evaluation.evaluation}: |
# self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
# -
# I check that state is "Plan in progress".
# -
# !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be 'Plan in progress' state}:
# - state == 'wait'
# -
# I find a mistake on evaluation form. So I cancel the evaluation and again start it.
# -
# !python {model: hr_evaluation.evaluation}: |
# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
# self.button_cancel(cr, uid, [ref('hr_evaluation_evaluation_0')])
# assert evaluation.state == 'cancel', 'Evaluation should be in cancel state'
# self.button_draft(cr, uid, [ref('hr_evaluation_evaluation_0')])
# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
# assert evaluation.state == 'draft', 'Evaluation should be in draft state'
# self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
# -
# I check that state is "Plan in progress" and "Interview Request" record is created
# -
# !python {model: hr_evaluation.evaluation}: |
# interview_obj = self.pool.get('hr.evaluation.interview')
# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
# assert evaluation.state == 'wait', "Evaluation should be 'Plan in progress' state"
# interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
# assert len(interview_ids), "Interview evaluation survey not created"
# -
# Give answer of the first page in "Employee Evaluation" survey.
# -
# !python {model: survey.question.wiz}: |
# name_wiz_obj=self.pool.get('survey.name.wiz')
# interview_obj = self.pool.get('hr.evaluation.interview')
# interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
# assert len(interview_ids), "Interview evaluation survey not created"
# ctx = {'active_model':'hr.evaluation.interview', 'active_id': interview_ids[0], 'active_ids': [interview_ids], 'survey_id': ref("survey_2")}
# name_id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_2")})
# ctx ["sur_name_id"] = name_id
# self.create(cr, uid, {str(ref("survey_question_2")) +"_" +str(ref("survey_answer_1")) + "_multi" :'tpa',
# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_10")) + "_multi" :'application eng',
# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_20")) + "_multi" :'3',
# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_25")) + "_multi" :'2011-12-02 16:42:00',
# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_43")) + "_multi" :'HR',
# }, context = ctx)
# -
# I close this Evaluation survey by giving answer of questions.
# -
# !python {model: hr_evaluation.evaluation}: |
# interview_obj = self.pool.get('hr.evaluation.interview')
# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
# interview_obj.survey_req_done(cr, uid, [r.id for r in evaluation.survey_request_ids])
# for survey in evaluation.survey_request_ids:
# interview = interview_obj.browse(cr, uid, survey.id, context)
# assert interview.state == "done", 'survey must be in done state'
# -
# I print the evaluation.
# -
# !python {model: hr_evaluation.evaluation}: |
# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
# self.pool.get('hr.evaluation.interview').action_print_survey(cr, uid, [r.id for r in evaluation.survey_request_ids])
# -
# I click on "Final Validation" button to finalise evaluation.
# -
# !python {model: hr_evaluation.evaluation}: |
# self.button_final_validation(cr, uid, [ref("hr_evaluation_evaluation_0")])
# -
# I check that state is "Waiting Appreciation".
# -
# !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
# - state == 'progress'
# -
# Give Rating "Meet expectations" by selecting overall Rating.
# -
# !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
# rating: '2'
# -
# I close this Evaluation by click on "Done" button of this wizard.
# -
# !python {model: hr_evaluation.evaluation}: |
# self.button_done(cr, uid, [ref("hr_evaluation_evaluation_0")])
# -
# I check that state of Evaluation is done.
# -
# !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be in done state}:
# - state == 'done'
# -
# Print Evaluations Statistics Report
# -
# !python {model: hr.evaluation.report}: |
# import os, time
# from openerp import tools
# ctx={}
# data_dict={'state': 'done', 'rating': 2, 'employee_id': ref("hr.employee_fp")}
# from openerp.tools import test_reports
# test_reports.try_report_action(cr, uid, 'hr_evaluation_evaluation_0',wiz_data=data_dict, context=ctx, our_module='hr_evaluation')

View File

@ -25,7 +25,7 @@
'version': '1.0',
'category': 'Human Resources',
'sequence': 25,
'summary': 'Jobs, Recruitment, Applications, Job Interviews',
'summary': 'Jobs, Recruitment, Applications, Job Interviews, Surveys',
'description': """
Manage job positions and the recruitment process
================================================
@ -37,7 +37,8 @@ You can define the different phases of interviews and easily rate the applicant
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ['images/hr_recruitment_analysis.jpeg','images/hr_recruitment_applicants.jpeg','static/src/img/down1.png'],
'images': ['images/hr_recruitment_analysis.jpeg',
'images/hr_recruitment_applicants.jpeg'],
'depends': [
'decimal_precision',
'hr',
@ -56,6 +57,7 @@ You can define the different phases of interviews and easily rate the applicant
'board_hr_recruitment_statistical_view.xml',
'hr_recruitment_installer_view.xml',
'res_config_view.xml',
'survey_data_recruitment.xml',
'hr_recruitment_data.xml',
],
'demo': ['hr_recruitment_demo.xml'],
@ -63,10 +65,8 @@ You can define the different phases of interviews and easily rate the applicant
'static/src/js/job_position.js',
],
'test': ['test/recruitment_process.yml'],
'css':['static/src/css/job_position.css'],
'css': ['static/src/css/job_position.css'],
'installable': True,
'auto_install': False,
'application': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -211,8 +211,8 @@ class hr_applicant(osv.Model):
'partner_mobile': fields.char('Mobile', size=32),
'type_id': fields.many2one('hr.recruitment.degree', 'Degree'),
'department_id': fields.many2one('hr.department', 'Department'),
'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
'response': fields.integer("Response"),
'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey.survey', string='Survey'),
'response_id': fields.many2one('survey.user_input', "Response", ondelete='set null', oldname="response"),
'reference': fields.char('Referred By', size=128),
'source_id': fields.many2one('hr.recruitment.source', 'Source'),
'day_open': fields.function(_compute_day, string='Days to Open', \
@ -311,24 +311,34 @@ class hr_applicant(osv.Model):
}
return res
def action_print_survey(self, cr, uid, ids, context=None):
"""
If response is available then print this response otherwise print survey form(print template of the survey).
def action_start_survey(self, cr, uid, ids, context=None):
context = context if context else {}
applicant = self.browse(cr, uid, ids, context=context)[0]
survey_obj = self.pool.get('survey.survey')
response_obj = self.pool.get('survey.user_input')
# create a response and link it to this applicant
if not applicant.response_id:
response_id = response_obj.create(cr, uid, {'survey_id': applicant.survey.id, 'partner_id': applicant.partner_id.id}, context=context)
self.write(cr, uid, ids[0], {'response_id': response_id}, context=context)
else:
response_id = applicant.response_id.id
# grab the token of the response and start surveying
response = response_obj.browse(cr, uid, response_id, context=context)
context.update({'survey_token': response.token})
return survey_obj.action_start_survey(cr, uid, [applicant.survey.id], context=context)
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Survey IDs
@param context: A standard dictionary for contextual values
@return: Dictionary value for print survey form.
"""
if context is None:
context = {}
record = self.browse(cr, uid, ids, context=context)
record = record and record[0]
context.update({'survey_id': record.survey.id, 'response_id': [record.response], 'response_no': 0, })
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
return value
def action_print_survey(self, cr, uid, ids, context=None):
""" If response is available then print this response otherwise print survey form (print template of the survey) """
context = context if context else {}
applicant = self.browse(cr, uid, ids, context=context)[0]
survey_obj = self.pool.get('survey.survey')
response_obj = self.pool.get('survey.user_input')
if not applicant.response_id:
return survey_obj.action_print_survey(cr, uid, [applicant.survey.id], context=context)
else:
response = response_obj.browse(cr, uid, applicant.response_id.id, context=context)
context.update({'survey_token': response.token})
return survey_obj.action_print_survey(cr, uid, [applicant.survey.id], context=context)
def action_get_attachment_tree_view(self, cr, uid, ids, context=None):
model, action_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'action_attachment')
@ -391,9 +401,9 @@ class hr_applicant(osv.Model):
ids = [ids]
res = True
# user_id change: update date_start
# user_id change: update date_open
if vals.get('user_id'):
vals['date_start'] = fields.datetime.now()
vals['date_open'] = fields.datetime.now()
# stage_id: track last stage before update
if 'stage_id' in vals:
vals['date_last_stage_update'] = fields.datetime.now()
@ -518,7 +528,7 @@ class hr_job(osv.osv):
return res
_columns = {
'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
'survey_id': fields.many2one('survey.survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
help="Email alias for this job position. New emails will automatically "
"create new applicants for this job position."),
@ -559,21 +569,9 @@ class hr_job(osv.osv):
return res
def action_print_survey(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = {}
record = self.browse(cr, uid, ids, context=context)[0]
if record.survey_id:
datas['ids'] = [record.survey_id.id]
datas['model'] = 'survey.print'
context.update({'response_id': [0], 'response_no': 0})
return {
'type': 'ir.actions.report.xml',
'report_name': 'survey.form',
'datas': datas,
'context': context,
'nodestroy': True,
}
job = self.browse(cr, uid, ids, context=context)[0]
survey_id = job.survey_id.id
return self.pool.get('survey.survey').action_print_survey(cr, uid, [survey_id], context=context)
def action_get_attachment_tree_view(self, cr, uid, ids, context=None):
#open attachments of job and related applicantions.

View File

@ -118,379 +118,6 @@
<field name="fold" eval="True"/>
</record>
<record id="survey_job_0" model="survey">
<field name="title">Job Survey</field>
<field name="max_response_limit">20</field>
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
</record>
<record id="survey_page_job_0" model="survey.page">
<field name="title">Default Section</field>
<field name="survey_id" ref="survey_job_0"/>
<field eval="1" name="sequence"/>
</record>
<record id="survey_page_job_1" model="survey.page">
<field name="title">Education &amp; Activities</field>
<field name="survey_id" ref="survey_job_0"/>
<field eval="2" name="sequence"/>
</record>
<record id="survey_page_job_2" model="survey.page">
<field name="title">Importance</field>
<field name="survey_id" ref="survey_job_0"/>
<field eval="3" name="sequence"/>
</record>
<record id="survey_question_job_0" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="1" name="sequence"/>
<field name="question">From which university will you graduate?</field>
<field eval="0" name="is_require_answer"/>
<field name="type">single_textbox</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_0"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_question_job_1" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="1" name="sequence"/>
<field name="question">Rate the Importance</field>
<field eval="0" name="is_require_answer"/>
<field name="type">matrix_of_choices_only_one_ans</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_2"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_question_job_2" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="1" name="sequence"/>
<field name="question">Education</field>
<field eval="0" name="is_require_answer"/>
<field name="type">comment</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_1"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_question_job_3" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="2" name="sequence"/>
<field name="question">Knowledge</field>
<field eval="0" name="is_require_answer"/>
<field name="type">comment</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_1"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_question_job_4" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="2" name="sequence"/>
<field name="question">What is your gender?</field>
<field eval="0" name="is_require_answer"/>
<field name="type">multiple_choice_only_one_ans</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_0"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_answer_job_70" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Male</field>
<field name="question_id" ref="survey_question_job_4"/>
<field eval="1" name="sequence"/>
</record>
<record id="survey_answer_job_71" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Female</field>
<field name="question_id" ref="survey_question_job_4"/>
<field eval="2" name="sequence"/>
</record>
<record id="survey_question_job_5" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="3" name="sequence"/>
<field name="question">What age group do you belong to?</field>
<field eval="0" name="is_require_answer"/>
<field name="type">multiple_choice_only_one_ans</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_0"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_answer_job_81" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">0 - 15</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="1" name="sequence"/>
</record>
<record id="survey_answer_job_82" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">16 - 20</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="2" name="sequence"/>
</record>
<record id="survey_answer_job_83" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">21 - 30</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="3" name="sequence"/>
</record>
<record id="survey_answer_job_84" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">31 - 40</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="4" name="sequence"/>
</record>
<record id="survey_answer_job_85" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">41 - 50</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="5" name="sequence"/>
</record>
<record id="survey_answer_job_86" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">51 - 60</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="6" name="sequence"/>
</record>
<record id="survey_answer_job_87" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">61 - 70</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="7" name="sequence"/>
</record>
<record id="survey_answer_job_88" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">71 +</field>
<field name="question_id" ref="survey_question_job_5"/>
<field eval="8" name="sequence"/>
</record>
<record id="survey_question_job_6" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="3" name="sequence"/>
<field name="question">Experience</field>
<field eval="0" name="is_require_answer"/>
<field name="type">comment</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_1"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_question_job_7" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="validation_type">do_not_validate</field>
<field name="comment_valid_type">do_not_validate</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field name="numeric_required_sum_err_msg">The choices need to add up to [enter sum here].</field>
<field eval="0" name="comment_column"/>
<field name="validation_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="rating_allow_one_column_require"/>
<field name="req_error_msg">This question requires an answer.</field>
<field eval="4" name="sequence"/>
<field name="question">Activities</field>
<field eval="0" name="is_require_answer"/>
<field name="type">comment</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
<field name="page_id" ref="survey_page_job_1"/>
<field name="comment_label">Other</field>
<field eval="1" name="in_visible_rating_weight"/>
<field eval="0" name="allow_comment"/>
</record>
<record id="survey_question_column_heading_job_0" model="survey.question.column.heading">
<field eval="1" name="in_visible_menu_choice"/>
<field name="title">Not important</field>
<field eval="1" name="in_visible_rating_weight"/>
<field name="question_id" ref="survey_question_job_1"/>
</record>
<record id="survey_question_column_heading_job_1" model="survey.question.column.heading">
<field eval="1" name="in_visible_menu_choice"/>
<field name="title">Somewhat important</field>
<field eval="1" name="in_visible_rating_weight"/>
<field name="question_id" ref="survey_question_job_1"/>
</record>
<record id="survey_question_column_heading_job_2" model="survey.question.column.heading">
<field eval="1" name="in_visible_menu_choice"/>
<field name="title">Important</field>
<field eval="1" name="in_visible_rating_weight"/>
<field name="question_id" ref="survey_question_job_1"/>
</record>
<record id="survey_question_column_heading_job_3" model="survey.question.column.heading">
<field eval="1" name="in_visible_menu_choice"/>
<field name="title">Very important</field>
<field eval="1" name="in_visible_rating_weight"/>
<field name="question_id" ref="survey_question_job_1"/>
</record>
<record id="survey_question_column_heading_job_4" model="survey.question.column.heading">
<field eval="1" name="in_visible_menu_choice"/>
<field name="title">Most important</field>
<field eval="1" name="in_visible_rating_weight"/>
<field name="question_id" ref="survey_question_job_1"/>
</record>
<record id="survey_answer_job_0" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Good pay</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="1" name="sequence"/>
</record>
<record id="survey_answer_job_1" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Getting on with colleagues</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="2" name="sequence"/>
</record>
<record id="survey_answer_job_2" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Office environment (décor, light, space etc)</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="3" name="sequence"/>
</record>
<record id="survey_answer_job_3" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Desk space</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="4" name="sequence"/>
</record>
<record id="survey_answer_job_4" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">State of the art technology</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="5" name="sequence"/>
</record>
<record id="survey_answer_job_5" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Office location (proximity to home)</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="6" name="sequence"/>
</record>
<record id="survey_answer_job_6" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Good management/boss</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="7" name="sequence"/>
</record>
<record id="survey_answer_job_7" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Freebies such as tea, coffee and stationery</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="8" name="sequence"/>
</record>
<record id="survey_answer_job_8" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Perks such as free parking, gym passes etc</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="9" name="sequence"/>
</record>
<record id="survey_answer_job_9" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">No out of hours working</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="10" name="sequence"/>
</record>
<record id="survey_answer_job_10" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Dress code</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="11" name="sequence"/>
</record>
<record id="survey_answer_job_11" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Regular meetings</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="12" name="sequence"/>
</record>
<record id="survey_answer_job_12" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Good social life (office nights out, good Christmas parties etc)</field>
<field name="question_id" ref="survey_question_job_1"/>
<field eval="13" name="sequence"/>
</record>
<record id="mail_alias_jobs" model="mail.alias">
<field name="alias_name">jobs</field>
<field name="alias_model_id" ref="model_hr_applicant"/>

View File

@ -126,35 +126,35 @@
<record id="hr.job_developer" model="hr.job">
<field name="state">recruit</field>
<field name="no_of_recruitment">4</field>
<field name="survey_id" ref="survey_job_0"/>
<field name="survey_id" ref="recruitment_form"/>
</record>
<record id="hr.job_ceo" model="hr.job">
<field name="survey_id" ref="survey_job_0"/>
<field name="survey_id" ref="recruitment_form"/>
</record>
<record id="hr.job_cto" model="hr.job">
<field name="survey_id" ref="survey_job_0"/>
<field name="survey_id" ref="recruitment_form"/>
</record>
<record id="hr.job_consultant" model="hr.job">
<field name="state">recruit</field>
<field name="no_of_recruitment">1</field>
<field name="survey_id" ref="survey_job_0"/>
<field name="survey_id" ref="recruitment_form"/>
</record>
<record id="hr.job_hrm" model="hr.job">
<field name="no_of_recruitment">1</field>
<field name="state">recruit</field>
<field name="survey_id" ref="survey_job_0"/>
<field name="survey_id" ref="recruitment_form"/>
</record>
<record id="hr.job_marketing" model="hr.job">
<field name="state">recruit</field>
<field name="no_of_recruitment">3</field>
<field name="survey_id" ref="survey_job_0"/>
<field name="survey_id" ref="recruitment_form"/>
</record>
<record id="hr.job_trainee" model="hr.job">
<field name="state">recruit</field>
<field name="no_of_recruitment">6</field>
<field name="survey_id" ref="survey_job_0"/>
<field name="survey_id" ref="recruitment_form"/>
</record>
-->
<record id="message_application_demo" model="mail.message">
<field name="model">hr.applicant</field>
<field name="res_id" ref="hr_case_advertisement"/>

View File

@ -54,7 +54,7 @@
<field name="date_action" invisible="context.get('invisible_next_date', True)"/>
<field name="source_id" invisible="1"/>
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<field name="response_id" invisible="1"/>
<field name="priority"/>
<field name="type_id" invisible="1"/>
<field name="availability" invisible="1"/>
@ -76,9 +76,9 @@
<div class="oe_right oe_button_box">
<button name="action_makeMeeting" type="object"
string="Schedule Meeting" help="Schedule interview with this applicant"/>
<button name="%(survey.action_view_survey_question_message)d" type="action"
<button name="action_start_survey" type="object"
string="Start Interview" help="Answer related job question"
context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant'}"
context="{'survey_id': survey}"
attrs="{'invisible':[('survey','=',False)]}"/>
<button name="action_print_survey" type="object"
string="Print Interview" help="Print interview report"
@ -93,7 +93,7 @@
<field name="partner_name" class="oe_inline"/>
<button string="Create Employee" name="create_employee_from_applicant" type="object"
class="oe_link oe_inline" style="margin-left: 8px;"
attrs="{'invisible': [('emp_id', '!=', False)]}"/>
attrs="{'invisible': [('emp_id', '!=', False)]}"/>
</h2>
</div>
<group>
@ -106,7 +106,7 @@
<field name="type_id" placeholder="Degree"/>
</group>
<group>
<field name="user_id"
<field name="user_id"
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>
<label for="title_action"/>
<div>
@ -119,7 +119,7 @@
</group>
<group string="Job">
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<field name="response_id" invisible="1"/>
<field name="job_id" on_change="onchange_job(job_id)"/>
<field name="department_id" on_change="onchange_department_id(department_id, stage_id)"/>
<field name="company_id" />
@ -183,7 +183,7 @@
<separator/>
<filter string="Next Actions" context="{'invisible_next_action':False, 'invisible_next_date':False}"
domain="[('date_action','&lt;&gt;',False)]" help="Filter and view on next actions and date"/>
<field name="job_id"/>
<field name="department_id"/>
<field name="user_id"/>
@ -260,7 +260,7 @@
<li><a name="action_makeMeeting" type="object">Schedule Interview</a></li>
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
</ul>
</div>
<div class="oe_kanban_content" tooltip="kanban-tooltip">
<div>
@ -295,9 +295,9 @@
</div>
<div class="oe_kanban_footer_left" style="margin-top:5px;">
<t t-raw="record.message_summary.raw_value"/>
<a t-if="record.attachment_number" name="action_get_attachment_tree_view" type="object" style="margin-right: 10px"> <field name="attachment_number"/> Documents</a>
<a t-if="record.attachment_number" name="action_get_attachment_tree_view" type="object" style="margin-right: 10px"> <field name="attachment_number"/> Documents</a>
</div>
</div>
<div class="oe_clear"></div>
</div>
@ -318,7 +318,7 @@
process and follow up all operations: meetings, interviews, etc.
</p><p>
Applicants and their attached CV are created automatically when an email is sent.
If you install the document management modules, all resumes are indexed automatically,
If you install the document management modules, all resumes are indexed automatically,
so that you can easily search through their content.
</p>
</field>
@ -345,7 +345,7 @@
<group name="employee_data" position="inside">
<label for="survey_id" groups="base.group_user"/>
<div groups="base.group_user">
<field name="survey_id" class="oe_inline" domain="[('type','=','Human Resources')]"/>
<field name="survey_id" class="oe_inline" domain="[('res_model','=','hr_recruitment')]"/>
<button string="Print Interview" name="action_print_survey" type="object" attrs="{'invisible':[('survey_id','=',False)]}" class="oe_inline oe_link"/>
</div>
<label for="address_id"/>
@ -425,7 +425,7 @@
<div class="oe_job_alias oe_kanban_ellipsis" t-if=" record.alias_id.value and record.state.raw_value == 'recruit'">
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
</div>
</div>
<t t-if="record.state.raw_value == 'recruit'">
<div class="oe_applications">
@ -483,7 +483,7 @@
<field name="context">{'search_default_in_recruitment': 1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click here to create a new job or remove the filter on "In Recruitment" to recruit for an on hold job.
Click here to create a new job or remove the filter on "In Recruitment" to recruit for an on hold job.
</p>
<p>
Define job position profile and manage recruitment in a context of a particular job: print interview survey, define number of expected new employees, and manage its recruitment pipe

View File

@ -4,7 +4,7 @@ access_hr_recruitment_report,hr.recruitment.report,model_hr_recruitment_report,b
access_hr_recruitment_stage_user,hr.recruitment.stage.user,model_hr_recruitment_stage,base.group_hr_user,1,1,1,1
access_hr_recruitment_degree,hr.recruitment.degree,model_hr_recruitment_degree,base.group_hr_user,1,1,1,1
access_res_partner_hr_user,res.partner.user,base.model_res_partner,base.group_hr_user,1,1,1,1
access_survey_hr_user,survey.hr.user,survey.model_survey,base.group_hr_user,1,1,1,0
access_survey_hr_user,survey.hr.user,survey.model_survey_survey,base.group_hr_user,1,1,1,0
access_calendar_event_hruser,calendar.event.hruser,calendar.model_calendar_event,base.group_hr_user,1,1,1,1
access_hr_recruitment_source_hr_officer,hr.recruitment.source,model_hr_recruitment_source,base.group_hr_user,1,1,1,1
access_hr_recruitment_source_all,hr.recruitment.source,model_hr_recruitment_source,,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_hr_recruitment_stage_user hr.recruitment.stage.user model_hr_recruitment_stage base.group_hr_user 1 1 1 1
5 access_hr_recruitment_degree hr.recruitment.degree model_hr_recruitment_degree base.group_hr_user 1 1 1 1
6 access_res_partner_hr_user res.partner.user base.model_res_partner base.group_hr_user 1 1 1 1
7 access_survey_hr_user survey.hr.user survey.model_survey survey.model_survey_survey base.group_hr_user 1 1 1 0
8 access_calendar_event_hruser calendar.event.hruser calendar.model_calendar_event base.group_hr_user 1 1 1 1
9 access_hr_recruitment_source_hr_officer hr.recruitment.source model_hr_recruitment_source base.group_hr_user 1 1 1 1
10 access_hr_recruitment_source_all hr.recruitment.source model_hr_recruitment_source 1 0 0 0

View File

@ -1,4 +1,5 @@
openerp.hr_recruitment = function (openerp) {
"use strict";
openerp.web_kanban.KanbanRecord.include({
on_card_clicked: function() {
@ -10,4 +11,4 @@ openerp.hr_recruitment = function (openerp) {
},
});
}
};

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Recruitment Form -->
<record model="survey.survey" id="recruitment_form">
<field name="title">Recruitment Form</field>
<field name="stage_id" ref="survey.stage_permanent" />
<field name="res_model">hr_recruitment</field>
<field name="auth_required" eval="True" />
<field name="users_can_go_back" eval="True" />
<field name="description">&lt;p&gt;This form is intended to help the responsible of a recruitment interview.&lt;/p&gt;</field>
<field name="thank_you_message">&lt;p&gt;&lt;/p&gt;</field>
</record>
<!-- Page 1 -->
<record model="survey.page" id="recruitment_1">
<field name="title">Basic information</field>
<field name="survey_id" ref="recruitment_form" />
<field name="sequence">1</field>
<field name="description">&lt;p&gt;&lt;/p&gt;</field>
</record>
<record model="survey.question" id="recruitment_1_1">
<field name="page_id" ref="recruitment_1" />
<field name="sequence">1</field>
<field name="question">From which university will you graduate?</field>
<field name="type">textbox</field>
</record>
<record model="survey.question" id="recruitment_1_2">
<field name="page_id" ref="recruitment_1" />
<field name="sequence">2</field>
<field name="question">What is your gender?</field>
<field name="type">simple_choice</field>
<field name="display_mode">dropdown</field>
</record>
<record model="survey.label" id="recruitment_1_2_1">
<field name="question_id" ref="recruitment_1_2"/>
<field name="sequence">1</field>
<field name="value">Male</field>
</record>
<record model="survey.label" id="recruitment_1_2_2">
<field name="question_id" ref="recruitment_1_2"/>
<field name="sequence">2</field>
<field name="value">Female</field>
</record>
<record model="survey.question" id="recruitment_1_3">
<field name="page_id" ref="recruitment_1" />
<field name="sequence">3</field>
<field name="question">What age group do you belong to?</field>
<field name="type">simple_choice</field>
<field name="display_mode">columns</field>
<field name="column_nb">4</field>
</record>
<record model="survey.label" id="recruitment_1_3_1">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">1</field>
<field name="value">0-15</field>
</record>
<record model="survey.label" id="recruitment_1_3_2">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">2</field>
<field name="value">16-20</field>
</record>
<record model="survey.label" id="recruitment_1_3_3">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">3</field>
<field name="value">21-30</field>
</record>
<record model="survey.label" id="recruitment_1_3_4">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">4</field>
<field name="value">31-40</field>
</record>
<record model="survey.label" id="recruitment_1_3_5">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">5</field>
<field name="value">41-50</field>
</record>
<record model="survey.label" id="recruitment_1_3_6">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">6</field>
<field name="value">51-60</field>
</record>
<record model="survey.label" id="recruitment_1_3_7">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">7</field>
<field name="value">61-70</field>
</record>
<record model="survey.label" id="recruitment_1_3_8">
<field name="question_id" ref="recruitment_1_3"/>
<field name="sequence">8</field>
<field name="value">71+</field>
</record>
<!-- Page 2 -->
<record model="survey.page" id="recruitment_2">
<field name="title">Education and Activities</field>
<field name="survey_id" ref="recruitment_form" />
<field name="sequence">2</field>
<field name="description">&lt;p&gt;&lt;/p&gt;</field>
</record>
<record model="survey.question" id="recruitment_2_1">
<field name="page_id" ref="recruitment_2" />
<field name="sequence">1</field>
<field name="question">Knowledge</field>
<field name="type">free_text</field>
</record>
<record model="survey.question" id="recruitment_2_2">
<field name="page_id" ref="recruitment_2" />
<field name="sequence">2</field>
<field name="question">Education</field>
<field name="type">free_text</field>
</record>
<record model="survey.question" id="recruitment_2_3">
<field name="page_id" ref="recruitment_2" />
<field name="sequence">3</field>
<field name="question">Experience</field>
<field name="type">free_text</field>
</record>
<record model="survey.question" id="recruitment_2_4">
<field name="page_id" ref="recruitment_2" />
<field name="sequence">4</field>
<field name="question">Activities</field>
<field name="type">free_text</field>
</record>
<!-- Page 3 -->
<record model="survey.page" id="recruitment_3">
<field name="title">Importance</field>
<field name="survey_id" ref="recruitment_form" />
<field name="sequence">3</field>
<field name="description">&lt;p&gt;&lt;/p&gt;</field>
</record>
<record model="survey.question" id="recruitment_3_1">
<field name="page_id" ref="recruitment_3" />
<field name="sequence">1</field>
<field name="question">Rate the Importance</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
</record>
<record model="survey.label" id="rcol_3_1_1">
<field name="question_id" ref="recruitment_3_1"/>
<field name="sequence">1</field>
<field name="value">Not important</field>
</record>
<record model="survey.label" id="rcol_3_1_2">
<field name="question_id" ref="recruitment_3_1"/>
<field name="sequence">2</field>
<field name="value">Somewhat important</field>
</record>
<record model="survey.label" id="rcol_3_1_3">
<field name="question_id" ref="recruitment_3_1"/>
<field name="sequence">3</field>
<field name="value">Important</field>
</record>
<record model="survey.label" id="rcol_3_1_4">
<field name="question_id" ref="recruitment_3_1"/>
<field name="sequence">4</field>
<field name="value">Very important</field>
</record>
<record model="survey.label" id="rcol_3_1_5">
<field name="question_id" ref="recruitment_3_1"/>
<field name="sequence">5</field>
<field name="value">Most important</field>
</record>
<record model="survey.label" id="rrow_2_1_1">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">1</field>
<field name="value">Good pay</field>
</record>
<record model="survey.label" id="rrow_2_1_2">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">2</field>
<field name="value">Getting on with colleagues</field>
</record>
<record model="survey.label" id="rrow_2_1_3">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">3</field>
<field name="value">Office environment</field>
</record>
<record model="survey.label" id="rrow_2_1_4">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">4</field>
<field name="value">Desk space</field>
</record>
<record model="survey.label" id="rrow_2_1_5">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">5</field>
<field name="value">State of the art technology</field>
</record>
<record model="survey.label" id="rrow_2_1_6">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">6</field>
<field name="value">Office location</field>
</record>
<record model="survey.label" id="rrow_2_1_7">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">7</field>
<field name="value">Good management</field>
</record>
<record model="survey.label" id="rrow_2_1_8">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">8</field>
<field name="value">Freebies such as tea, coffee and stationery</field>
</record>
<record model="survey.label" id="rrow_2_1_9">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">9</field>
<field name="value">Perks such as free parking, gym passes</field>
</record>
<record model="survey.label" id="rrow_2_1_10">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">10</field>
<field name="value">No out of hours working</field>
</record>
<record model="survey.label" id="rrow_2_1_11">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">11</field>
<field name="value">Dress code</field>
</record>
<record model="survey.label" id="rrow_2_1_12">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">12</field>
<field name="value">Regular meetings</field>
</record>
<record model="survey.label" id="rrow_2_1_13">
<field name="question_id_2" ref="recruitment_3_1"/>
<field name="sequence">13</field>
<field name="value">Good social life</field>
</record>
</data>
</openerp>

View File

@ -47,16 +47,6 @@
-
!python {model: hr.applicant}: |
self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
-
Applicant fillup the answer of the interview quetion.
-
!python {model: survey.question.wiz}: |
ctx = context.copy()
ctx.update({'active_model': 'hr.applicant', 'active_id': ref("hr_case_programmer"), 'active_ids': [ref("hr_case_programmer")], 'survey_id': ref("survey_job_0")})
self.fields_view_get(cr, uid, ref("survey.view_survey_question_message"),"form", context=ctx)
vals = self.default_get(cr, uid , [], context=ctx)
self.create(cr, uid, vals, context=ctx)
self.action_new_page(cr, uid, [ref("survey_job_0")], context=ctx)
-
I print Applicant fill up the interview quetion
-

View File

@ -3,6 +3,7 @@ import commands
import logging
import simplejson
import os
import os.path
import io
import base64
import openerp
@ -11,6 +12,8 @@ import random
import math
import md5
import openerp.addons.hw_proxy.controllers.main as hw_proxy
import pickle
import re
import subprocess
import traceback
from threading import Thread, Lock
@ -45,10 +48,58 @@ class EscposDriver(Thread):
self.lock = Lock()
self.status = {'status':'connecting', 'messages':[]}
def supported_devices(self):
if not os.path.isfile('escpos_devices.pickle'):
return supported_devices.device_list
else:
try:
f = open('escpos_devices.pickle','r')
return pickle.load(f)
f.close()
except Exception as e:
self.set_status('error',str(e))
return supported_devices.device_list
def add_supported_device(self,device_string):
r = re.compile('[0-9A-Fa-f]{4}:[0-9A-Fa-f]{4}');
match = r.search(device_string)
if match:
match = match.group().split(':')
vendor = int(match[0],16)
product = int(match[1],16)
name = device_string.split('ID')
if len(name) >= 2:
name = name[1]
else:
name = name[0]
_logger.info('ESC/POS: adding support for device: '+match[0]+':'+match[1]+' '+name)
device_list = supported_devices.device_list[:]
if os.path.isfile('escpos_devices.pickle'):
try:
f = open('escpos_devices.pickle','r')
device_list = pickle.load(f)
f.close()
except Exception as e:
self.set_status('error',str(e))
device_list.append({
'vendor': vendor,
'product': product,
'name': name,
})
try:
f = open('escpos_devices.pickle','w+')
f.seek(0)
pickle.dump(device_list,f)
f.close()
except Exception as e:
self.set_status('error',str(e))
def connected_usb_devices(self):
connected = []
for device in supported_devices.device_list:
for device in self.supported_devices():
if usb.core.find(idVendor=device['vendor'], idProduct=device['product']) != None:
connected.append(device)
return connected
@ -83,8 +134,9 @@ class EscposDriver(Thread):
printer.cashdraw(5)
def set_status(self, status, message = None):
_logger.info(status+' : '+ (message or 'no message'))
if status == self.status['status']:
if message != None and message != self.status['messages'][-1]:
if message != None and (len(self.status['messages']) == 0 or message != self.status['messages'][-1]):
self.status['messages'].append(message)
else:
self.status['status'] = status
@ -307,7 +359,22 @@ class EscposProxy(hw_proxy.Proxy):
driver.push_task('receipt',receipt)
@http.route('/hw_proxy/print_xml_receipt', type='json', auth='none', cors='*')
def print_receipt(self, receipt):
def print_xml_receipt(self, receipt):
_logger.info('ESC/POS: PRINT XML RECEIPT')
driver.push_task('xml_receipt',receipt)
@http.route('/hw_proxy/escpos/add_supported_device', type='http', auth='none', cors='*')
def add_supported_device(self, device_string):
_logger.info('ESC/POS: ADDED NEW DEVICE:'+device_string)
driver.add_supported_device(device_string)
return "The device:\n"+device_string+"\n has been added to the list of supported devices.<br/><a href='/hw_proxy/status'>Ok</a>"
@http.route('/hw_proxy/escpos/reset_supported_devices', type='http', auth='none', cors='*')
def reset_supported_devices(self):
try:
os.remove('escpos_devices.pickle')
except Exception as e:
pass
return 'The list of supported devices has been reset to factory defaults.<br/><a href="/hw_proxy/status">Ok</a>'

View File

@ -97,6 +97,22 @@ class Proxy(http.Controller):
device_name = device[device.find('ID')+2:]
resp+= "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n"
resp += "</div>\n"
resp += """
<h2>Add New Printer</h2>
<p>
Copy and paste your printer's device description in the form below. You can find
your printer's description in the device list above. If you find that your printer works
well, please send your printer's description to <a href='mailto:support@openerp.com'>
support@openerp.com</a> so that we can add it to the default list of supported devices.
</p>
<form action='/hw_proxy/escpos/add_supported_device' method='GET'>
<input type='text' style='width:400px' name='device_string' placeholder='123a:b456 Sample Device description' />
<input type='submit' value='submit' />
</form>
<h2>Reset To Defaults</h2>
<p>If the added devices cause problems, you can <a href='/hw_proxy/escpos/reset_supported_devices'>Reset the
device list to factory default.</a> This operation cannot be undone.</p>
"""
resp += "</body>\n</html>\n\n"
return request.make_response(resp,{

View File

@ -1511,8 +1511,7 @@ class mail_thread(osv.AbstractModel):
if subtype:
if '.' not in subtype:
subtype = 'mail.%s' % subtype
ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, *subtype.split('.'))
subtype_id = ref and ref[1] or False
subtype_id = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, subtype)
# automatically subscribe recipients if asked to
if context.get('mail_post_autofollow') and thread_id and partner_ids:

View File

@ -118,10 +118,18 @@ class res_users(osv.Model):
various mailboxes, we do not have access to the current partner_id. """
if isinstance(thread_id, (list, tuple)):
thread_id = thread_id[0]
current_pids = []
partner_ids = kwargs.get('partner_ids', [])
partner_id = self._message_post_get_pid(cr, uid, thread_id, context=context)
if partner_id not in [command[1] for command in partner_ids]:
partner_ids.append(partner_id)
user_pid = self._message_post_get_pid(cr, uid, thread_id, context=context)
for partner_id in partner_ids:
if isinstance(partner_id, (list, tuple)) and partner_id[0] == 4 and len(partner_id) == 2:
current_pids.append(partner_id[1])
elif isinstance(partner_id, (list, tuple)) and partner_id[0] == 6 and len(partner_id) == 3:
current_pids.append(partner_id[2])
elif isinstance(partner_id, (int, long)):
current_pids.append(partner_id)
if user_pid not in current_pids:
partner_ids.append(user_pid)
kwargs['partner_ids'] = partner_ids
return self.pool.get('mail.thread').message_post(cr, uid, False, **kwargs)

View File

@ -664,13 +664,9 @@
.openerp .oe_followers .oe_partner .oe_hidden{
display: none;
}
.openerp.ui-dialog .ui-dialog-titlebar .ui-dialog-title{
padding-right: 20px;
}
.openerp .oe_followers .oe_show_more{
cursor: pointer;
}
/* ---------------- MESSAGES BODY ------------------ */
.openerp .oe_mail .oe_msg_content .oe_blockquote,
.openerp .oe_mail .oe_msg_content blockquote {

View File

@ -94,19 +94,17 @@ openerp_mail_followers = function(session, mail) {
var $currentTarget = $(event.currentTarget);
var user_pid = $currentTarget.data('id');
$('div.oe_edit_actions').remove();
self.$dialog = new session.web.dialog($('<div class="oe_edit_actions">'), {
modal: true,
width: 'auto',
height: 'auto',
self.$dialog = new session.web.Dialog(this, {
size: 'small',
title: _t('Edit Subscription of ') + $currentTarget.siblings('a').text(),
buttons: [
{ text: _t("Apply"), click: function() {
self.do_update_subscription(event, user_pid);
$(this).dialog("close");
this.parents('.modal').modal('hide');
}},
{ text: _t("Cancel"), click: function() { $(this).dialog("close"); }}
{ text: _t("Cancel"), click: function() { this.parents('.modal').modal('hide'); }}
],
});
}, "<div class='oe_edit_actions'>").open();
return self.fetch_subtypes(user_pid);
},
@ -272,7 +270,7 @@ openerp_mail_followers = function(session, mail) {
display_subtypes:function (data, id, dialog) {
var self = this;
if (dialog) {
var $list = self.$dialog;
var $list = self.$dialog.$el;
}
else {
var $list = this.$('.oe_subtype_list ul');

View File

@ -22,7 +22,7 @@
{
'name': 'Dates on Sales Order',
'version': '1.0',
'version': '1.1',
'category': 'Sales Management',
'description': """
Add additional date information to the sales order.
@ -30,7 +30,7 @@ Add additional date information to the sales order.
You can add the following additional dates to a sales order:
------------------------------------------------------------
* Requested Date
* Requested Date (will be used as the expected date on pickings)
* Commitment Date
* Effective Date
""",
@ -40,7 +40,7 @@ You can add the following additional dates to a sales order:
'depends': ['sale_stock'],
'data': ['sale_order_dates_view.xml'],
'demo': [],
'test': [],
'test': ['test/requested_date.yml'],
'installable': True,
'auto_install': False,
}

View File

@ -32,12 +32,14 @@ msgstr ""
#. module: sale_order_dates
#: help:sale.order,effective_date:0
msgid "Date on which picking is created."
msgid "Date on which the first Delivery Order was created."
msgstr ""
#. module: sale_order_dates
#: help:sale.order,requested_date:0
msgid "Date requested by the customer for the sale."
msgid "Date by which the customer has requested the items to be delivered.\n"
"When this Order gets confirmed, the Delivery Order's expected date will be computed based on this date and the Company's Security Delay.\n"
"Leave this field empty if you want the Delivery Order to be processed as soon as possible. In that case the expected date will be computed using the default method: based on the Product Lead Times and the Company's Security Delay."
msgstr ""
#. module: sale_order_dates
@ -52,6 +54,18 @@ msgstr ""
#. module: sale_order_dates
#: help:sale.order,commitment_date:0
msgid "Committed date for delivery."
msgid "Date by which the products are sure to be delivered. This is a date that you can promise to the customer, based on the Product Lead Times."
msgstr ""
#. module: sale_order_dates
#: code:addons/sale_order_dates/sale_order_dates.py:90
#, python-format
msgid "Requested date is too soon!"
msgstr ""
#. module: sale_order_dates
#: code:addons/sale_order_dates/sale_order_dates.py:91
#, python-format
msgid "The date requested by the customer is sooner than the commitment date. You may be unable to honor the customer's request."
msgstr ""

View File

@ -19,15 +19,37 @@
#
##############################################################################
from datetime import datetime
from dateutil.relativedelta import relativedelta
from datetime import datetime, timedelta
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
class sale_order_dates(osv.osv):
"""Add several date fields to Sale Orders, computed or user-entered"""
_inherit = 'sale.order'
def copy(self, cr, uid, id, default=None, context=None):
"""Don't copy the requested date along with the Sales Order"""
default = dict(default or {}, requested_date=False)
return super(sale_order_dates, self).copy(cr, uid, id, default=default,
context=context)
def _get_date_planned(self, cr, uid, order, line, start_date, context=None):
"""Compute the expected date from the requested date, not the order date"""
if order and order.requested_date:
planned_str = self.date_to_datetime(cr, uid,
order.requested_date, context)
date_planned = datetime.strptime(planned_str,
DEFAULT_SERVER_DATETIME_FORMAT)
date_planned -= timedelta(days=order.company_id.security_lead)
return date_planned.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
return super(sale_order_dates, self)._get_date_planned(
cr, uid, order, line, start_date, context=context)
def _get_effective_date(self, cr, uid, ids, name, arg, context=None):
"""Read the shipping date from the related packings"""
# TODO: would be better if it returned the date the picking was processed?
res = {}
dates_list = []
for order in self.browse(cr, uid, ids, context=context):
@ -41,22 +63,57 @@ class sale_order_dates(osv.osv):
return res
def _get_commitment_date(self, cr, uid, ids, name, arg, context=None):
"""Compute the commitment date"""
res = {}
dates_list = []
for order in self.browse(cr, uid, ids, context=context):
order_datetime_str = self.date_to_datetime(cr, uid, order.date_order,
context)
order_datetime = datetime.strptime(order_datetime_str,
DEFAULT_SERVER_DATETIME_FORMAT)
dates_list = []
for line in order.order_line:
dt = datetime.strptime(order.date_order, '%Y-%m-%d') + relativedelta(days=line.delay or 0.0)
dt_s = dt.strftime('%Y-%m-%d')
dt = order_datetime + timedelta(days=line.delay or 0.0)
dt_s = dt.strftime(DEFAULT_SERVER_DATE_FORMAT)
dates_list.append(dt_s)
if dates_list:
res[order.id] = min(dates_list)
return res
def onchange_requested_date(self, cr, uid, ids, requested_date,
commitment_date, context=None):
"""Warn if the requested dates is sooner than the commitment date"""
if (requested_date and commitment_date
and requested_date < commitment_date):
return {'warning': {
'title': _('Requested date is too soon!'),
'message': _("The date requested by the customer is "
"sooner than the commitment date. You may be "
"unable to honor the customer's request.")
}
}
return {}
_columns = {
'commitment_date': fields.function(_get_commitment_date, store=True, type='date', string='Commitment Date', help="Committed date for delivery."),
'requested_date': fields.date('Requested Date', help="Date requested by the customer for the sale."),
'effective_date': fields.function(_get_effective_date, type='date', store=True, string='Effective Date',help="Date on which picking is created."),
'commitment_date': fields.function(_get_commitment_date, store=True,
type='date', string='Commitment Date',
help="Date by which the products are sure to be delivered. This is "
"a date that you can promise to the customer, based on the "
"Product Lead Times."),
'requested_date': fields.date('Requested Date',
readonly=True, states={'draft': [('readonly', False)]},
help="Date by which the customer has requested the items to be "
"delivered.\n"
"When this Order gets confirmed, the Delivery Order's "
"expected date will be computed based on this date and the "
"Company's Security Delay.\n"
"Leave this field empty if you want the Delivery Order to be "
"processed as soon as possible. In that case the expected "
"date will be computed using the default method: based on "
"the Product Lead Times and the Company's Security Delay."),
'effective_date': fields.function(_get_effective_date, type='date',
store=True, string='Effective Date',
help="Date on which the first Delivery Order was created."),
}

View File

@ -10,13 +10,23 @@
<group name="sale_pay" position="after">
<group colspan="2" col="2" >
<separator string="Dates" colspan="2"/>
<field name="requested_date"/>
<field name="requested_date" on_change="onchange_requested_date(requested_date, commitment_date)"/>
<field name="commitment_date"/>
<field name="effective_date"/>
</group>
</group>
</field>
</record>
<record id="view_order_tree_date" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml">
<field name="date_order" position="after">
<field name="requested_date"/>
<field name="commitment_date"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,32 @@
-
In order to test the Requested Date feature in Sale Orders in OpenERP,
I update a demo Sale Order with Requested Date on 2010-12-17
-
!python {model: sale.order}: |
self.write(cr, uid, ref("sale.sale_order_6"), {'requested_date': '2010-07-12'})
-
I confirm the Sale Order.
-
!workflow {
model: sale.order, action: order_confirm,
ref: sale.sale_order_6
}
-
I verify that the Procurements and Stock Moves have been generated with the
correct date
-
!python {model: sale.order}: |
from datetime import datetime, timedelta
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
so = self.browse(cr, uid, ref("sale.sale_order_6"))
security_delay = timedelta(days=so.company_id.security_lead)
requested_date = datetime.strptime(
self.date_to_datetime(cr, uid, so.requested_date),
DEFAULT_SERVER_DATETIME_FORMAT)
right_date = (requested_date - security_delay).strftime(
DEFAULT_SERVER_DATETIME_FORMAT)
for line in so.order_line:
assert line.procurement_id, "No Procurement was created"
assert line.procurement_id.date_planned == right_date, "The planned date for the Procurement Order is wrong"
assert line.procurement_id.move_id.date_expected == right_date, "The expected date for the Stock Move is wrong"

View File

@ -21,7 +21,6 @@
##############################################################################
from datetime import datetime, timedelta
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare
from dateutil.relativedelta import relativedelta
from openerp.osv import fields, osv
from openerp.tools.translate import _
import pytz
@ -257,7 +256,7 @@ class sale_order(osv.osv):
if tz_name:
utc = pytz.timezone('UTC')
context_tz = pytz.timezone(tz_name)
user_datetime = user_date + relativedelta(hours=12.0)
user_datetime = user_date + timedelta(hours=12.0)
local_timestamp = context_tz.localize(user_datetime, is_dst=False)
user_datetime = local_timestamp.astimezone(utc)
return user_datetime.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
@ -379,8 +378,9 @@ class sale_order(osv.osv):
return True
def _get_date_planned(self, cr, uid, order, line, start_date, context=None):
"""Compute the Stock Move date for the Sale Order Line"""
start_date = self.date_to_datetime(cr, uid, start_date, context)
date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=line.delay or 0.0)
date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(days=line.delay or 0.0)
date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
return date_planned

View File

@ -20,7 +20,5 @@
##############################################################################
import survey
import controllers
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,44 +21,39 @@
{
'name': 'Survey',
'version': '1.0',
'category': 'Tools',
'version': '2.0',
'category': 'Marketing',
'description': """
This module is used for surveying.
==================================
Create beautiful web surveys and visualize answers
==================================================
It depends on the answers or reviews of some questions by different users. A
survey may have multiple pages. Each page may contain multiple questions and each
question may have multiple answers. Different users may give different answers of
question and according to that survey is done. Partners are also sent mails with
user name and password for the invitation of the survey.
survey may have multiple pages. Each page may contain multiple questions and
each question may have multiple answers. Different users may give different
answers of question and according to that survey is done. Partners are also
sent mails with personal token for the invitation of the survey.
""",
'summary': 'Create surveys, collect answers and print statistics',
'author': 'OpenERP SA',
'depends': ['mail'],
'website': 'https://www.openerp.com/apps/survey/',
'depends': ['email_template', 'mail', 'website', 'marketing'],
'data': [
'survey_report.xml',
'survey_data.xml',
'wizard/survey_selection.xml',
'wizard/survey_answer.xml',
'security/survey_security.xml',
'security/ir.model.access.csv',
'survey_view.xml',
'wizard/survey_print_statistics.xml',
'wizard/survey_print_answer.xml',
'wizard/survey_browse_answer.xml',
'wizard/survey_print.xml',
'wizard/survey_send_invitation.xml'
],
'demo': ['survey_demo.xml'],
'test': [
'test/draft2open2close_survey.yml',
'test/draft2open2close_request.yml',
'test/survey_question_type.yml',
'test/survey_report.yml',
'views/survey_views.xml',
'views/survey_templates.xml',
'views/survey_result.xml',
'wizard/survey_email_compose_message.xml',
'data/survey_stages.xml',
'data/survey_cron.xml'
],
'demo': ['data/survey_demo_user.xml',
'data/survey_demo_feedback.xml',
'data/survey.user_input.csv',
'data/survey.user_input_line.csv'],
'installable': True,
'auto_install': False,
'images': ['images/survey_answers.jpeg','images/survey_pages.jpeg','images/surveys.jpeg'],
'css': ['static/src/css/survey.css','static/css/survey.css'],
'application': True,
'sequence': 10,
'images': [],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -2,13 +2,12 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -20,8 +19,4 @@
#
##############################################################################
import survey_analysis_report
import survey_form
import survey_browse_response
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import main

View File

@ -0,0 +1,356 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import json
import logging
import werkzeug
from datetime import datetime
from math import ceil
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT as DTF
from openerp.tools.safe_eval import safe_eval
_logger = logging.getLogger(__name__)
class WebsiteSurvey(http.Controller):
## HELPER METHODS ##
def _check_bad_cases(self, cr, uid, request, survey_obj, survey, user_input_obj, context=None):
# In case of bad survey, redirect to surveys list
if survey_obj.exists(cr, SUPERUSER_ID, survey.id, context=context) == []:
return werkzeug.utils.redirect("/survey/")
# In case of auth required, block public user
if survey.auth_required and uid == request.registry['website'].get_public_user(cr, uid, context):
return request.website.render("website.403")
# In case of non open surveys
if survey.stage_id.closed:
return request.website.render("survey.notopen")
# If there is no pages
if not survey.page_ids:
return request.website.render("survey.nopages")
# Everything seems to be ok
return None
def _check_deadline(self, cr, uid, user_input, context=None):
'''Prevent opening of the survey if the deadline has turned out
! This will NOT disallow access to users who have already partially filled the survey !'''
if user_input.deadline:
dt_deadline = datetime.strptime(user_input.deadline, DTF)
dt_now = datetime.now()
if dt_now > dt_deadline: # survey is not open anymore
return request.website.render("survey.notopen")
return None
## ROUTES HANDLERS ##
# Survey start
@http.route(['/survey/start/<model("survey.survey"):survey>',
'/survey/start/<model("survey.survey"):survey>/<string:token>'],
type='http', auth='public', multilang=True, website=True)
def start_survey(self, survey, token=None, **post):
cr, uid, context = request.cr, request.uid, request.context
survey_obj = request.registry['survey.survey']
user_input_obj = request.registry['survey.user_input']
# Test mode
if token and token == "phantom":
_logger.info("[survey] Phantom mode")
user_input_id = user_input_obj.create(cr, uid, {'survey_id': survey.id, 'test_entry': True}, context=context)
user_input = user_input_obj.browse(cr, uid, [user_input_id], context=context)[0]
data = {'survey': survey, 'page': None, 'token': user_input.token}
return request.website.render('survey.survey_init', data)
# END Test mode
# Controls if the survey can be displayed
errpage = self._check_bad_cases(cr, uid, request, survey_obj, survey, user_input_obj, context=context)
if errpage:
return errpage
# Manual surveying
if not token:
user_input_id = user_input_obj.create(cr, uid, {'survey_id': survey.id}, context=context)
user_input = user_input_obj.browse(cr, uid, [user_input_id], context=context)[0]
else:
try:
user_input_id = user_input_obj.search(cr, uid, [('token', '=', token)], context=context)[0]
except IndexError: # Invalid token
return request.website.render("website.403")
else:
user_input = user_input_obj.browse(cr, uid, [user_input_id], context=context)[0]
# Do not open expired survey
errpage = self._check_deadline(cr, uid, user_input, context=context)
if errpage:
return errpage
# Select the right page
if user_input.state == 'new': # Intro page
data = {'survey': survey, 'page': None, 'token': user_input.token}
return request.website.render('survey.survey_init', data)
else:
return request.redirect('/survey/fill/%s/%s' % (survey.id, user_input.token))
# Survey displaying
@http.route(['/survey/fill/<model("survey.survey"):survey>/<string:token>',
'/survey/fill/<model("survey.survey"):survey>/<string:token>/<string:prev>'],
type='http', auth='public', multilang=True, website=True)
def fill_survey(self, survey, token, prev=None, **post):
'''Display and validates a survey'''
cr, uid, context = request.cr, request.uid, request.context
survey_obj = request.registry['survey.survey']
user_input_obj = request.registry['survey.user_input']
# Controls if the survey can be displayed
errpage = self._check_bad_cases(cr, uid, request, survey_obj, survey, user_input_obj, context=context)
if errpage:
return errpage
# Load the user_input
try:
user_input_id = user_input_obj.search(cr, uid, [('token', '=', token)])[0]
except IndexError: # Invalid token
return request.website.render("website.403")
else:
user_input = user_input_obj.browse(cr, uid, [user_input_id], context=context)[0]
# Do not display expired survey (even if some pages have already been
# displayed -- There's a time for everything!)
errpage = self._check_deadline(cr, uid, user_input, context=context)
if errpage:
return errpage
# Select the right page
if user_input.state == 'new': # First page
page, page_nr, last = survey_obj.next_page(cr, uid, user_input, 0, go_back=False, context=context)
data = {'survey': survey, 'page': page, 'page_nr': page_nr, 'token': user_input.token}
if last:
data.update({'last': True})
return request.website.render('survey.survey', data)
elif user_input.state == 'done': # Display success message
return request.website.render('survey.sfinished', {'survey': survey,
'token': token,
'user_input': user_input})
elif user_input.state == 'skip':
flag = (True if prev and prev == 'prev' else False)
page, page_nr, last = survey_obj.next_page(cr, uid, user_input, user_input.last_displayed_page_id.id, go_back=flag, context=context)
data = {'survey': survey, 'page': page, 'page_nr': page_nr, 'token': user_input.token}
if last:
data.update({'last': True})
return request.website.render('survey.survey', data)
else:
return request.website.render("website.403")
# AJAX prefilling of a survey
@http.route(['/survey/prefill/<model("survey.survey"):survey>/<string:token>',
'/survey/prefill/<model("survey.survey"):survey>/<string:token>/<model("survey.page"):page>'],
type='http', auth='public', multilang=True, website=True)
def prefill(self, survey, token, page=None, **post):
cr, uid, context = request.cr, request.uid, request.context
user_input_line_obj = request.registry['survey.user_input_line']
ret = {}
# Fetch previous answers
if page:
ids = user_input_line_obj.search(cr, uid, [('user_input_id.token', '=', token), ('page_id', '=', page.id)], context=context)
else:
ids = user_input_line_obj.search(cr, uid, [('user_input_id.token', '=', token)], context=context)
previous_answers = user_input_line_obj.browse(cr, uid, ids, context=context)
# Return non empty answers in a JSON compatible format
for answer in previous_answers:
if not answer.skipped:
answer_tag = '%s_%s_%s' % (answer.survey_id.id, answer.page_id.id, answer.question_id.id)
answer_value = None
if answer.answer_type == 'free_text':
answer_value = answer.value_free_text
elif answer.answer_type == 'text' and answer.question_id.type == 'textbox':
answer_value = answer.value_text
elif answer.answer_type == 'text' and answer.question_id.type != 'textbox':
# here come comment answers for matrices, simple choice and multiple choice
answer_tag = "%s_%s" % (answer_tag, 'comment')
answer_value = answer.value_text
elif answer.answer_type == 'number':
answer_value = answer.value_number.__str__()
elif answer.answer_type == 'date':
answer_value = answer.value_date
elif answer.answer_type == 'suggestion' and not answer.value_suggested_row:
answer_value = answer.value_suggested.id
elif answer.answer_type == 'suggestion' and answer.value_suggested_row:
answer_tag = "%s_%s" % (answer_tag, answer.value_suggested_row.id)
answer_value = answer.value_suggested.id
if answer_value:
dict_soft_update(ret, answer_tag, answer_value)
else:
_logger.warning("[survey] No answer has been found for question %s marked as non skipped" % answer_tag)
return json.dumps(ret)
# AJAX submission of a page
@http.route(['/survey/submit/<model("survey.survey"):survey>'],
type='http', auth='public', multilang=True, website=True)
def submit(self, survey, **post):
_logger.debug('Incoming data: %s', post)
page_id = int(post['page_id'])
cr, uid, context = request.cr, request.uid, request.context
survey_obj = request.registry['survey.survey']
questions_obj = request.registry['survey.question']
questions_ids = questions_obj.search(cr, uid, [('page_id', '=', page_id)], context=context)
questions = questions_obj.browse(cr, uid, questions_ids, context=context)
# Answer validation
errors = {}
for question in questions:
answer_tag = "%s_%s_%s" % (survey.id, page_id, question.id)
errors.update(questions_obj.validate_question(cr, uid, question, post, answer_tag, context=context))
ret = {}
if (len(errors) != 0):
# Return errors messages to webpage
ret['errors'] = errors
else:
# Store answers into database
user_input_obj = request.registry['survey.user_input']
user_input_line_obj = request.registry['survey.user_input_line']
try:
user_input_id = user_input_obj.search(cr, uid, [('token', '=', post['token'])], context=context)[0]
except KeyError: # Invalid token
return request.website.render("website.403")
for question in questions:
answer_tag = "%s_%s_%s" % (survey.id, page_id, question.id)
user_input_line_obj.save_lines(cr, uid, user_input_id, question, post, answer_tag, context=context)
user_input = user_input_obj.browse(cr, uid, user_input_id, context=context)
go_back = post['button_submit'] == 'previous'
next_page, _, last = survey_obj.next_page(cr, uid, user_input, page_id, go_back=go_back, context=context)
vals = {'last_displayed_page_id': page_id}
if next_page is None and not go_back:
vals.update({'state': 'done'})
else:
vals.update({'state': 'skip'})
user_input_obj.write(cr, uid, user_input_id, vals, context=context)
ret['redirect'] = '/survey/fill/%s/%s' % (survey.id, post['token'])
if go_back:
ret['redirect'] += '/prev'
return json.dumps(ret)
# Printing routes
@http.route(['/survey/print/<model("survey.survey"):survey>',
'/survey/print/<model("survey.survey"):survey>/<string:token>'],
type='http', auth='user', multilang=True, website=True)
def print_survey(self, survey, token=None, **post):
'''Display an survey in printable view; if <token> is set, it will
grab the answers of the user_input_id that has <token>.'''
return request.website.render('survey.survey_print',
{'survey': survey,
'token': token,
'page_nr': 0})
@http.route(['/survey/results/<model("survey.survey"):survey>'],
type='http', auth='user', multilang=True, website=True)
def survey_reporting(self, survey, token=None, **post):
'''Display survey Results & Statistics for given survey.'''
result_template, current_filters, filter_display_data, filter_finish = 'survey.result', [], [], False
survey_obj = request.registry['survey.survey']
if not survey.user_input_ids or not [input_id.id for input_id in survey.user_input_ids if input_id.state != 'new']:
result_template = 'survey.no_result'
if 'finished' in post:
post.pop('finished')
filter_finish = True
if post or filter_finish:
filter_data = self.get_filter_data(post)
current_filters = survey_obj.filter_input_ids(request.cr, request.uid, filter_data, filter_finish, context=request.context)
filter_display_data = survey_obj.get_filter_display_data(request.cr, request.uid, filter_data, context=request.context)
return request.website.render(result_template,
{'survey_dict': self.prepare_result_dict(survey, current_filters),
'page_range': self.page_range,
'current_filters': current_filters,
'filter_display_data': filter_display_data,
'filter_finish': filter_finish
})
def prepare_result_dict(self,survey, current_filters=[]):
"""Returns dictionary having values for rendering template"""
survey_obj = request.registry['survey.survey']
result = {'survey':survey, 'page_ids': []}
for page in survey.page_ids:
page_dict = {'page': page, 'question_ids': []}
for question in page.question_ids:
question_dict = {'question':question, 'input_summary':survey_obj.get_input_summary(request.cr, request.uid, question, current_filters, context=request.context), 'prepare_result':survey_obj.prepare_result(request.cr, request.uid, question, current_filters, context=request.context), 'graph_data': self.get_graph_data(question, current_filters)}
page_dict['question_ids'].append(question_dict)
result['page_ids'].append(page_dict)
return result
def get_filter_data(self, post):
"""Returns data used for filtering the result"""
filters = []
for ids in post:
#if user add some random data in query URI, ignore it
try:
row_id, answer_id = ids.split(',')
filters.append({'row_id': int(row_id), 'answer_id': int(answer_id)})
except:
return filters
return filters
def page_range(self, total_record, limit):
'''Returns number of pages required for pagination'''
total = ceil(total_record / float(limit))
return range(1, int(total + 1))
def get_graph_data(self, question, current_filters=[]):
'''Returns formatted data required by graph library on basis of filter'''
survey_obj = request.registry['survey.survey']
result = []
if question.type == 'multiple_choice':
result.append({'key': str(question.question),
'values': survey_obj.prepare_result(request.cr, request.uid, question, current_filters, context=request.context)})
if question.type == 'simple_choice':
result = survey_obj.prepare_result(request.cr, request.uid, question, current_filters, context=request.context)
if question.type == 'matrix':
data = survey_obj.prepare_result(request.cr, request.uid, question, current_filters, context=request.context)
for answer in data['answers']:
values = []
for res in data['result']:
if res[1] == answer:
values.append({'text': data['rows'][res[0]], 'count': data['result'][res]})
result.append({'key': data['answers'].get(answer), 'values': values})
return json.dumps(result)
def dict_soft_update(dictionary, key, value):
''' Insert the pair <key>: <value> into the <dictionary>. If <key> is
already present, this function will append <value> to the list of
existing data (instead of erasing it) '''
if key in dictionary:
dictionary[key].append(value)
else:
dictionary.update({key: [value]})

View File

@ -0,0 +1,7 @@
id,survey_id:id,state
ui1,feedback_form,done
ui2,feedback_form,done
ui3,feedback_form,done
ui4,feedback_form,skip
ui5,feedback_form,skip
ui6,feedback_form,new
1 id survey_id:id state
2 ui1 feedback_form done
3 ui2 feedback_form done
4 ui3 feedback_form done
5 ui4 feedback_form skip
6 ui5 feedback_form skip
7 ui6 feedback_form new

View File

@ -0,0 +1,125 @@
id,user_input_id:id,question_id:id,skipped,answer_type,value_text,value_number,value_date,value_free_text,value_suggested:id,value_suggested_row:id
uil_1,ui1,feedback_1_1,,suggestion,,,,,choice_1_1_1,
uil_2,ui1,feedback_1_2,,suggestion,,,,,choice_1_2_2,
uil_3,ui1,feedback_2_1,,suggestion,,,,,fcol_2_1_2,frow_2_1_1
uil_4,ui1,feedback_2_1,,suggestion,,,,,fcol_2_1_3,frow_2_1_2
uil_5,ui1,feedback_2_1,,suggestion,,,,,fcol_2_1_4,frow_2_1_3
uil_6,ui1,feedback_2_1,,suggestion,,,,,fcol_2_1_1,frow_2_1_4
uil_7,ui1,feedback_2_1,,suggestion,,,,,fcol_2_1_2,frow_2_1_5
uil_8,ui1,feedback_2_2,,suggestion,,,,,fcol_2_2_4,frow_2_2_1
uil_9,ui1,feedback_2_2,,suggestion,,,,,fcol_2_2_1,frow_2_2_2
uil_10,ui1,feedback_2_2,,suggestion,,,,,fcol_2_2_2,frow_2_2_3
uil_11,ui1,feedback_2_2,,suggestion,,,,,fcol_2_2_3,frow_2_2_4
uil_12,ui1,feedback_2_2,,suggestion,,,,,fcol_2_2_4,frow_2_2_5
uil_13,ui1,feedback_2_3,,free_text,,,,It is very difficult to understand,,
uil_14,ui1,feedback_2_4,,suggestion,,,,,choice_2_4_1,
uil_15,ui1,feedback_2_4,,suggestion,,,,,choice_2_4_2,
uil_16,ui1,feedback_2_5,,suggestion,,,,,fcol_2_5_3,frow_2_5_1
uil_17,ui1,feedback_2_5,,suggestion,,,,,fcol_2_5_4,frow_2_5_2
uil_18,ui1,feedback_2_5,,suggestion,,,,,fcol_2_5_1,frow_2_5_3
uil_19,ui1,feedback_2_5,,suggestion,,,,,fcol_2_5_2,frow_2_5_4
uil_20,ui1,feedback_2_5,,suggestion,,,,,fcol_2_5_3,frow_2_5_5
uil_21,ui1,feedback_2_6,,suggestion,,,,,choice_2_6_2,
uil_22,ui1,feedback_2_7,,suggestion,,,,,fcol_2_7_2,frow_2_7_1
uil_23,ui1,feedback_2_7,,suggestion,,,,,fcol_2_7_3,frow_2_7_2
uil_24,ui1,feedback_2_7,,suggestion,,,,,fcol_2_7_4,frow_2_7_3
uil_25,ui1,feedback_2_7,,suggestion,,,,,fcol_2_7_1,frow_2_7_4
uil_26,ui1,feedback_3_1,,suggestion,,,,,choice_3_1_1,
uil_27,ui1,feedback_3_1,,suggestion,,,,,choice_3_1_5,
uil_28,ui1,feedback_3_2,,free_text,,,,Accept merge proposals more quickly,,
uil_29,ui1,feedback_3_3,,free_text,,,,Pay them!,,
uil_30,ui1,feedback_4_1,,suggestion,,,,,choice_4_1_2,
uil_31,ui1,feedback_4_1,,suggestion,,,,,choice_4_1_3,
uil_32,ui1,feedback_4_1,,suggestion,,,,,choice_4_1_4,
uil_33,ui2,feedback_1_1,,suggestion,,,,,choice_1_1_3,
uil_34,ui2,feedback_1_2,,suggestion,,,,,choice_1_2_3,
uil_35,ui2,feedback_2_1,,suggestion,,,,,fcol_2_1_3,frow_2_1_1
uil_36,ui2,feedback_2_1,,suggestion,,,,,fcol_2_1_4,frow_2_1_2
uil_37,ui2,feedback_2_1,,suggestion,,,,,fcol_2_1_1,frow_2_1_3
uil_38,ui2,feedback_2_1,,suggestion,,,,,fcol_2_1_2,frow_2_1_4
uil_39,ui2,feedback_2_1,,suggestion,,,,,fcol_2_1_3,frow_2_1_5
uil_40,ui2,feedback_2_2,,suggestion,,,,,fcol_2_2_3,frow_2_2_1
uil_41,ui2,feedback_2_2,,suggestion,,,,,fcol_2_2_4,frow_2_2_2
uil_42,ui2,feedback_2_2,,suggestion,,,,,fcol_2_2_1,frow_2_2_3
uil_43,ui2,feedback_2_2,,suggestion,,,,,fcol_2_2_2,frow_2_2_4
uil_44,ui2,feedback_2_2,,suggestion,,,,,fcol_2_2_3,frow_2_2_5
uil_45,ui2,feedback_2_3,,free_text,,,,I prefer a command-line tool,,
uil_46,ui2,feedback_2_4,,suggestion,,,,,choice_2_4_3,
uil_47,ui2,feedback_2_4,,suggestion,,,,,choice_2_4_1,
uil_48,ui2,feedback_2_5,,suggestion,,,,,fcol_2_5_4,frow_2_5_1
uil_49,ui2,feedback_2_5,,suggestion,,,,,fcol_2_5_1,frow_2_5_2
uil_50,ui2,feedback_2_5,,suggestion,,,,,fcol_2_5_2,frow_2_5_3
uil_51,ui2,feedback_2_5,,suggestion,,,,,fcol_2_5_3,frow_2_5_4
uil_52,ui2,feedback_2_5,,suggestion,,,,,fcol_2_5_4,frow_2_5_5
uil_53,ui2,feedback_2_6,,suggestion,,,,,choice_2_6_1,
uil_54,ui2,feedback_2_7,,suggestion,,,,,fcol_2_7_3,frow_2_7_1
uil_55,ui2,feedback_2_7,,suggestion,,,,,fcol_2_7_4,frow_2_7_2
uil_56,ui2,feedback_2_7,,suggestion,,,,,fcol_2_7_1,frow_2_7_3
uil_57,ui2,feedback_2_7,,suggestion,,,,,fcol_2_7_2,frow_2_7_4
uil_58,ui2,feedback_3_1,,suggestion,,,,,choice_3_1_2,
uil_59,ui2,feedback_3_1,,suggestion,,,,,choice_3_1_3,
uil_60,ui2,feedback_3_1,,suggestion,,,,,choice_3_1_4,
uil_61,ui2,feedback_3_2,,free_text,,,,Reward most engaged contributors,,
uil_62,ui2,feedback_3_3,,free_text,,,,Launch OpenERP hackhatons,,
uil_63,ui2,feedback_4_1,,suggestion,,,,,choice_4_1_1,
uil_64,ui2,feedback_4_1,,suggestion,,,,,choice_4_1_2,
uil_65,ui2,feedback_4_1,,suggestion,,,,,choice_4_1_3,
uil_66,ui3,feedback_1_1,,suggestion,,,,,choice_1_1_1,
uil_67,ui3,feedback_1_2,,suggestion,,,,,choice_1_2_2,
uil_68,ui3,feedback_2_1,,suggestion,,,,,fcol_2_1_2,frow_2_1_1
uil_69,ui3,feedback_2_1,,suggestion,,,,,fcol_2_1_3,frow_2_1_2
uil_70,ui3,feedback_2_1,,suggestion,,,,,fcol_2_1_4,frow_2_1_3
uil_71,ui3,feedback_2_1,,suggestion,,,,,fcol_2_1_1,frow_2_1_4
uil_72,ui3,feedback_2_1,,suggestion,,,,,fcol_2_1_2,frow_2_1_5
uil_73,ui3,feedback_2_2,,suggestion,,,,,fcol_2_2_4,frow_2_2_1
uil_74,ui3,feedback_2_2,,suggestion,,,,,fcol_2_2_1,frow_2_2_2
uil_75,ui3,feedback_2_2,,suggestion,,,,,fcol_2_2_2,frow_2_2_3
uil_76,ui3,feedback_2_2,,suggestion,,,,,fcol_2_2_3,frow_2_2_4
uil_77,ui3,feedback_2_2,,suggestion,,,,,fcol_2_2_4,frow_2_2_5
uil_78,ui3,feedback_2_3,,free_text,,,,I prefer a command-line tool,,
uil_79,ui3,feedback_2_4,,suggestion,,,,,choice_2_4_1,
uil_80,ui3,feedback_2_4,,suggestion,,,,,choice_2_4_2,
uil_81,ui3,feedback_2_5,,suggestion,,,,,fcol_2_5_3,frow_2_5_1
uil_82,ui3,feedback_2_5,,suggestion,,,,,fcol_2_5_4,frow_2_5_2
uil_83,ui3,feedback_2_5,,suggestion,,,,,fcol_2_5_1,frow_2_5_3
uil_84,ui3,feedback_2_5,,suggestion,,,,,fcol_2_5_2,frow_2_5_4
uil_85,ui3,feedback_2_5,,suggestion,,,,,fcol_2_5_3,frow_2_5_5
uil_86,ui3,feedback_2_6,,suggestion,,,,,choice_2_6_2,
uil_87,ui3,feedback_2_7,,suggestion,,,,,fcol_2_7_2,frow_2_7_1
uil_88,ui3,feedback_2_7,,suggestion,,,,,fcol_2_7_3,frow_2_7_2
uil_89,ui3,feedback_2_7,,suggestion,,,,,fcol_2_7_4,frow_2_7_3
uil_90,ui3,feedback_2_7,,suggestion,,,,,fcol_2_7_1,frow_2_7_4
uil_91,ui3,feedback_3_1,,suggestion,,,,,choice_3_1_1,
uil_92,ui3,feedback_3_1,,suggestion,,,,,choice_3_1_5,
uil_93,ui3,feedback_3_2,,free_text,,,,Reward most engaged contributors,,
uil_94,ui3,feedback_3_3,,free_text,,,,Launch OpenERP hackhatons,,
uil_95,ui3,feedback_4_1,,suggestion,,,,,choice_4_1_2,
uil_96,ui3,feedback_4_1,,suggestion,,,,,choice_4_1_3,
uil_97,ui3,feedback_4_1,,suggestion,,,,,choice_4_1_4,
uil_98,ui4,feedback_1_1,,suggestion,,,,,choice_1_1_2,
uil_99,ui4,feedback_1_2,,suggestion,,,,,choice_1_2_3,
uil_100,ui4,feedback_2_1,,suggestion,,,,,fcol_2_1_1,frow_2_1_1
uil_101,ui4,feedback_2_1,,suggestion,,,,,fcol_2_1_2,frow_2_1_2
uil_102,ui4,feedback_2_1,,suggestion,,,,,fcol_2_1_3,frow_2_1_3
uil_103,ui4,feedback_2_1,,suggestion,,,,,fcol_2_1_4,frow_2_1_4
uil_104,ui4,feedback_2_1,,suggestion,,,,,fcol_2_1_1,frow_2_1_5
uil_105,ui4,feedback_2_2,,suggestion,,,,,fcol_2_2_4,frow_2_2_1
uil_106,ui4,feedback_2_2,,suggestion,,,,,fcol_2_2_1,frow_2_2_2
uil_107,ui4,feedback_2_2,,suggestion,,,,,fcol_2_2_2,frow_2_2_3
uil_108,ui4,feedback_2_2,,suggestion,,,,,fcol_2_2_3,frow_2_2_4
uil_109,ui4,feedback_2_2,,suggestion,,,,,fcol_2_2_4,frow_2_2_5
uil_110,ui4,feedback_2_3,,free_text,,,,A more graphical tool would be useful.,,
uil_111,ui4,feedback_2_4,,suggestion,,,,,choice_2_4_2,
uil_112,ui4,feedback_2_4,,suggestion,,,,,choice_2_4_3,
uil_113,ui4,feedback_2_5,,suggestion,,,,,fcol_2_5_3,frow_2_5_1
uil_114,ui4,feedback_2_5,,suggestion,,,,,fcol_2_5_4,frow_2_5_2
uil_115,ui4,feedback_2_5,,suggestion,,,,,fcol_2_5_1,frow_2_5_3
uil_116,ui4,feedback_2_5,,suggestion,,,,,fcol_2_5_2,frow_2_5_4
uil_117,ui4,feedback_2_5,,suggestion,,,,,fcol_2_5_3,frow_2_5_5
uil_118,ui4,feedback_2_6,,suggestion,,,,,choice_2_6_1,
uil_119,ui4,feedback_2_7,,suggestion,,,,,fcol_2_7_2,frow_2_7_1
uil_120,ui4,feedback_2_7,,suggestion,,,,,fcol_2_7_3,frow_2_7_2
uil_121,ui4,feedback_2_7,,suggestion,,,,,fcol_2_7_4,frow_2_7_3
uil_122,ui4,feedback_2_7,,suggestion,,,,,fcol_2_7_1,frow_2_7_4
uil_123,ui5,feedback_1_1,,suggestion,,,,,choice_1_1_1,
uil_124,ui5,feedback_1_2,,suggestion,,,,,choice_1_2_2,
1 id user_input_id:id question_id:id skipped answer_type value_text value_number value_date value_free_text value_suggested:id value_suggested_row:id
2 uil_1 ui1 feedback_1_1 suggestion choice_1_1_1
3 uil_2 ui1 feedback_1_2 suggestion choice_1_2_2
4 uil_3 ui1 feedback_2_1 suggestion fcol_2_1_2 frow_2_1_1
5 uil_4 ui1 feedback_2_1 suggestion fcol_2_1_3 frow_2_1_2
6 uil_5 ui1 feedback_2_1 suggestion fcol_2_1_4 frow_2_1_3
7 uil_6 ui1 feedback_2_1 suggestion fcol_2_1_1 frow_2_1_4
8 uil_7 ui1 feedback_2_1 suggestion fcol_2_1_2 frow_2_1_5
9 uil_8 ui1 feedback_2_2 suggestion fcol_2_2_4 frow_2_2_1
10 uil_9 ui1 feedback_2_2 suggestion fcol_2_2_1 frow_2_2_2
11 uil_10 ui1 feedback_2_2 suggestion fcol_2_2_2 frow_2_2_3
12 uil_11 ui1 feedback_2_2 suggestion fcol_2_2_3 frow_2_2_4
13 uil_12 ui1 feedback_2_2 suggestion fcol_2_2_4 frow_2_2_5
14 uil_13 ui1 feedback_2_3 free_text It is very difficult to understand
15 uil_14 ui1 feedback_2_4 suggestion choice_2_4_1
16 uil_15 ui1 feedback_2_4 suggestion choice_2_4_2
17 uil_16 ui1 feedback_2_5 suggestion fcol_2_5_3 frow_2_5_1
18 uil_17 ui1 feedback_2_5 suggestion fcol_2_5_4 frow_2_5_2
19 uil_18 ui1 feedback_2_5 suggestion fcol_2_5_1 frow_2_5_3
20 uil_19 ui1 feedback_2_5 suggestion fcol_2_5_2 frow_2_5_4
21 uil_20 ui1 feedback_2_5 suggestion fcol_2_5_3 frow_2_5_5
22 uil_21 ui1 feedback_2_6 suggestion choice_2_6_2
23 uil_22 ui1 feedback_2_7 suggestion fcol_2_7_2 frow_2_7_1
24 uil_23 ui1 feedback_2_7 suggestion fcol_2_7_3 frow_2_7_2
25 uil_24 ui1 feedback_2_7 suggestion fcol_2_7_4 frow_2_7_3
26 uil_25 ui1 feedback_2_7 suggestion fcol_2_7_1 frow_2_7_4
27 uil_26 ui1 feedback_3_1 suggestion choice_3_1_1
28 uil_27 ui1 feedback_3_1 suggestion choice_3_1_5
29 uil_28 ui1 feedback_3_2 free_text Accept merge proposals more quickly
30 uil_29 ui1 feedback_3_3 free_text Pay them!
31 uil_30 ui1 feedback_4_1 suggestion choice_4_1_2
32 uil_31 ui1 feedback_4_1 suggestion choice_4_1_3
33 uil_32 ui1 feedback_4_1 suggestion choice_4_1_4
34 uil_33 ui2 feedback_1_1 suggestion choice_1_1_3
35 uil_34 ui2 feedback_1_2 suggestion choice_1_2_3
36 uil_35 ui2 feedback_2_1 suggestion fcol_2_1_3 frow_2_1_1
37 uil_36 ui2 feedback_2_1 suggestion fcol_2_1_4 frow_2_1_2
38 uil_37 ui2 feedback_2_1 suggestion fcol_2_1_1 frow_2_1_3
39 uil_38 ui2 feedback_2_1 suggestion fcol_2_1_2 frow_2_1_4
40 uil_39 ui2 feedback_2_1 suggestion fcol_2_1_3 frow_2_1_5
41 uil_40 ui2 feedback_2_2 suggestion fcol_2_2_3 frow_2_2_1
42 uil_41 ui2 feedback_2_2 suggestion fcol_2_2_4 frow_2_2_2
43 uil_42 ui2 feedback_2_2 suggestion fcol_2_2_1 frow_2_2_3
44 uil_43 ui2 feedback_2_2 suggestion fcol_2_2_2 frow_2_2_4
45 uil_44 ui2 feedback_2_2 suggestion fcol_2_2_3 frow_2_2_5
46 uil_45 ui2 feedback_2_3 free_text I prefer a command-line tool
47 uil_46 ui2 feedback_2_4 suggestion choice_2_4_3
48 uil_47 ui2 feedback_2_4 suggestion choice_2_4_1
49 uil_48 ui2 feedback_2_5 suggestion fcol_2_5_4 frow_2_5_1
50 uil_49 ui2 feedback_2_5 suggestion fcol_2_5_1 frow_2_5_2
51 uil_50 ui2 feedback_2_5 suggestion fcol_2_5_2 frow_2_5_3
52 uil_51 ui2 feedback_2_5 suggestion fcol_2_5_3 frow_2_5_4
53 uil_52 ui2 feedback_2_5 suggestion fcol_2_5_4 frow_2_5_5
54 uil_53 ui2 feedback_2_6 suggestion choice_2_6_1
55 uil_54 ui2 feedback_2_7 suggestion fcol_2_7_3 frow_2_7_1
56 uil_55 ui2 feedback_2_7 suggestion fcol_2_7_4 frow_2_7_2
57 uil_56 ui2 feedback_2_7 suggestion fcol_2_7_1 frow_2_7_3
58 uil_57 ui2 feedback_2_7 suggestion fcol_2_7_2 frow_2_7_4
59 uil_58 ui2 feedback_3_1 suggestion choice_3_1_2
60 uil_59 ui2 feedback_3_1 suggestion choice_3_1_3
61 uil_60 ui2 feedback_3_1 suggestion choice_3_1_4
62 uil_61 ui2 feedback_3_2 free_text Reward most engaged contributors
63 uil_62 ui2 feedback_3_3 free_text Launch OpenERP hackhatons
64 uil_63 ui2 feedback_4_1 suggestion choice_4_1_1
65 uil_64 ui2 feedback_4_1 suggestion choice_4_1_2
66 uil_65 ui2 feedback_4_1 suggestion choice_4_1_3
67 uil_66 ui3 feedback_1_1 suggestion choice_1_1_1
68 uil_67 ui3 feedback_1_2 suggestion choice_1_2_2
69 uil_68 ui3 feedback_2_1 suggestion fcol_2_1_2 frow_2_1_1
70 uil_69 ui3 feedback_2_1 suggestion fcol_2_1_3 frow_2_1_2
71 uil_70 ui3 feedback_2_1 suggestion fcol_2_1_4 frow_2_1_3
72 uil_71 ui3 feedback_2_1 suggestion fcol_2_1_1 frow_2_1_4
73 uil_72 ui3 feedback_2_1 suggestion fcol_2_1_2 frow_2_1_5
74 uil_73 ui3 feedback_2_2 suggestion fcol_2_2_4 frow_2_2_1
75 uil_74 ui3 feedback_2_2 suggestion fcol_2_2_1 frow_2_2_2
76 uil_75 ui3 feedback_2_2 suggestion fcol_2_2_2 frow_2_2_3
77 uil_76 ui3 feedback_2_2 suggestion fcol_2_2_3 frow_2_2_4
78 uil_77 ui3 feedback_2_2 suggestion fcol_2_2_4 frow_2_2_5
79 uil_78 ui3 feedback_2_3 free_text I prefer a command-line tool
80 uil_79 ui3 feedback_2_4 suggestion choice_2_4_1
81 uil_80 ui3 feedback_2_4 suggestion choice_2_4_2
82 uil_81 ui3 feedback_2_5 suggestion fcol_2_5_3 frow_2_5_1
83 uil_82 ui3 feedback_2_5 suggestion fcol_2_5_4 frow_2_5_2
84 uil_83 ui3 feedback_2_5 suggestion fcol_2_5_1 frow_2_5_3
85 uil_84 ui3 feedback_2_5 suggestion fcol_2_5_2 frow_2_5_4
86 uil_85 ui3 feedback_2_5 suggestion fcol_2_5_3 frow_2_5_5
87 uil_86 ui3 feedback_2_6 suggestion choice_2_6_2
88 uil_87 ui3 feedback_2_7 suggestion fcol_2_7_2 frow_2_7_1
89 uil_88 ui3 feedback_2_7 suggestion fcol_2_7_3 frow_2_7_2
90 uil_89 ui3 feedback_2_7 suggestion fcol_2_7_4 frow_2_7_3
91 uil_90 ui3 feedback_2_7 suggestion fcol_2_7_1 frow_2_7_4
92 uil_91 ui3 feedback_3_1 suggestion choice_3_1_1
93 uil_92 ui3 feedback_3_1 suggestion choice_3_1_5
94 uil_93 ui3 feedback_3_2 free_text Reward most engaged contributors
95 uil_94 ui3 feedback_3_3 free_text Launch OpenERP hackhatons
96 uil_95 ui3 feedback_4_1 suggestion choice_4_1_2
97 uil_96 ui3 feedback_4_1 suggestion choice_4_1_3
98 uil_97 ui3 feedback_4_1 suggestion choice_4_1_4
99 uil_98 ui4 feedback_1_1 suggestion choice_1_1_2
100 uil_99 ui4 feedback_1_2 suggestion choice_1_2_3
101 uil_100 ui4 feedback_2_1 suggestion fcol_2_1_1 frow_2_1_1
102 uil_101 ui4 feedback_2_1 suggestion fcol_2_1_2 frow_2_1_2
103 uil_102 ui4 feedback_2_1 suggestion fcol_2_1_3 frow_2_1_3
104 uil_103 ui4 feedback_2_1 suggestion fcol_2_1_4 frow_2_1_4
105 uil_104 ui4 feedback_2_1 suggestion fcol_2_1_1 frow_2_1_5
106 uil_105 ui4 feedback_2_2 suggestion fcol_2_2_4 frow_2_2_1
107 uil_106 ui4 feedback_2_2 suggestion fcol_2_2_1 frow_2_2_2
108 uil_107 ui4 feedback_2_2 suggestion fcol_2_2_2 frow_2_2_3
109 uil_108 ui4 feedback_2_2 suggestion fcol_2_2_3 frow_2_2_4
110 uil_109 ui4 feedback_2_2 suggestion fcol_2_2_4 frow_2_2_5
111 uil_110 ui4 feedback_2_3 free_text A more graphical tool would be useful.
112 uil_111 ui4 feedback_2_4 suggestion choice_2_4_2
113 uil_112 ui4 feedback_2_4 suggestion choice_2_4_3
114 uil_113 ui4 feedback_2_5 suggestion fcol_2_5_3 frow_2_5_1
115 uil_114 ui4 feedback_2_5 suggestion fcol_2_5_4 frow_2_5_2
116 uil_115 ui4 feedback_2_5 suggestion fcol_2_5_1 frow_2_5_3
117 uil_116 ui4 feedback_2_5 suggestion fcol_2_5_2 frow_2_5_4
118 uil_117 ui4 feedback_2_5 suggestion fcol_2_5_3 frow_2_5_5
119 uil_118 ui4 feedback_2_6 suggestion choice_2_6_1
120 uil_119 ui4 feedback_2_7 suggestion fcol_2_7_2 frow_2_7_1
121 uil_120 ui4 feedback_2_7 suggestion fcol_2_7_3 frow_2_7_2
122 uil_121 ui4 feedback_2_7 suggestion fcol_2_7_4 frow_2_7_3
123 uil_122 ui4 feedback_2_7 suggestion fcol_2_7_1 frow_2_7_4
124 uil_123 ui5 feedback_1_1 suggestion choice_1_1_1
125 uil_124 ui5 feedback_1_2 suggestion choice_1_2_2

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<!-- Remove unused user inputs -->
<record forcecreate="True" id="ir_cron_clean_empty_surveys"
model="ir.cron">
<field name="name">Run Clean empty surveys</field>
<field name="active" eval="True"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model" eval="'survey.user_input'"/>
<field name="function" eval="'do_clean_emptys'"/>
<field name="args" eval="'()'"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,441 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- User Feedback Form -->
<record model="survey.survey" id="feedback_form">
<field name="title">User Feedback Form</field>
<field name="stage_id" ref="survey.stage_in_progress" />
<field name="auth_required" eval="False" />
<field name="users_can_go_back" eval="True" />
<field name="description">&lt;p&gt;This survey should take less than five minutes.&lt;/p&gt;</field>
<field name="thank_you_message">&lt;p&gt;&lt;/p&gt;</field>
</record>
<!-- Page 1 -->
<record model="survey.page" id="feedback_1">
<field name="title">About your OpenERP usage</field>
<field name="survey_id" ref="feedback_form" />
<field name="sequence">1</field>
<field name="description">&lt;p&gt;&lt;/p&gt;</field>
</record>
<record model="survey.question" id="feedback_1_1">
<field name="page_id" ref="feedback_1" />
<field name="sequence">1</field>
<field name="question">Are you using OpenERP on a daily basis?</field>
<field name="type">simple_choice</field>
<field name="display_mode">dropdown</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="choice_1_1_1">
<field name="question_id" ref="feedback_1_1"/>
<field name="sequence">1</field>
<field name="value">Yes, I use a version &lt; 7.0</field>
</record>
<record model="survey.label" id="choice_1_1_2">
<field name="question_id" ref="feedback_1_1"/>
<field name="sequence">2</field>
<field name="value">Yes, I use the 7.0 version, installed locally</field>
</record>
<record model="survey.label" id="choice_1_1_3">
<field name="question_id" ref="feedback_1_1"/>
<field name="sequence">3</field>
<field name="value">Yes, I use the online version of OpenERP</field>
</record>
<record model="survey.label" id="choice_1_1_4">
<field name="question_id" ref="feedback_1_1"/>
<field name="sequence">4</field>
<field name="value">No, I just tested it</field>
</record>
<record model="survey.question" id="feedback_1_2">
<field name="page_id" ref="feedback_1" />
<field name="sequence">2</field>
<field name="question">Which modules are you using/testing?</field>
<field name="type">multiple_choice</field>
<field name="column_nb">4</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="choice_1_2_1">
<field name="question_id" ref="feedback_1_2"/>
<field name="sequence">1</field>
<field name="value">Sales Management</field>
</record>
<record model="survey.label" id="choice_1_2_2">
<field name="question_id" ref="feedback_1_2"/>
<field name="sequence">2</field>
<field name="value">Purchases Management</field>
</record>
<record model="survey.label" id="choice_1_2_3">
<field name="question_id" ref="feedback_1_2"/>
<field name="sequence">3</field>
<field name="value">Financial Management</field>
</record>
<record model="survey.label" id="choice_1_2_4">
<field name="question_id" ref="feedback_1_2"/>
<field name="sequence">4</field>
<field name="value">CRM</field>
</record>
<record model="survey.label" id="choice_1_2_5">
<field name="question_id" ref="feedback_1_2"/>
<field name="sequence">5</field>
<field name="value">Project Management</field>
</record>
<record model="survey.label" id="choice_1_2_6">
<field name="question_id" ref="feedback_1_2"/>
<field name="sequence">6</field>
<field name="value">Human Ressources</field>
</record>
<!-- Page 2 -->
<record model="survey.page" id="feedback_2">
<field name="title">Ergonomy and ease of use</field>
<field name="survey_id" ref="feedback_form" />
<field name="sequence">2</field>
<field name="description">&lt;p&gt;These questions relate to the ergonomy and ease of use of OpenERP. Try to remind your firsts days on OpenERP and
what have been your difficulties.&lt;/p&gt;</field>
</record>
<record model="survey.question" id="feedback_2_1">
<field name="page_id" ref="feedback_2" />
<field name="sequence">1</field>
<field name="question">What do you think about the documentation available on doc.openerp.com?</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="fcol_2_1_1">
<field name="question_id" ref="feedback_2_1"/>
<field name="sequence">1</field>
<field name="value">Totally disagree</field>
</record>
<record model="survey.label" id="fcol_2_1_2">
<field name="question_id" ref="feedback_2_1"/>
<field name="sequence">2</field>
<field name="value">Disagree</field>
</record>
<record model="survey.label" id="fcol_2_1_3">
<field name="question_id" ref="feedback_2_1"/>
<field name="sequence">3</field>
<field name="value">Agree</field>
</record>
<record model="survey.label" id="fcol_2_1_4">
<field name="question_id" ref="feedback_2_1"/>
<field name="sequence">4</field>
<field name="value">Totally agree</field>
</record>
<record model="survey.label" id="frow_2_1_1">
<field name="question_id_2" ref="feedback_2_1"/>
<field name="sequence">1</field>
<field name="value">It is up-to-date</field>
</record>
<record model="survey.label" id="frow_2_1_2">
<field name="question_id_2" ref="feedback_2_1"/>
<field name="sequence">2</field>
<field name="value">It helps in the beginning</field>
</record>
<record model="survey.label" id="frow_2_1_3">
<field name="question_id_2" ref="feedback_2_1"/>
<field name="sequence">3</field>
<field name="value">I use the contextual help in OpenERP</field>
</record>
<record model="survey.label" id="frow_2_1_4">
<field name="question_id_2" ref="feedback_2_1"/>
<field name="sequence">4</field>
<field name="value">It is complete</field>
</record>
<record model="survey.label" id="frow_2_1_5">
<field name="question_id_2" ref="feedback_2_1"/>
<field name="sequence">5</field>
<field name="value">It is clear</field>
</record>
<record model="survey.question" id="feedback_2_2">
<field name="page_id" ref="feedback_2" />
<field name="sequence">2</field>
<field name="question">What do you think about the process views of OpenERP, available in the web client ?</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="fcol_2_2_1">
<field name="question_id" ref="feedback_2_2"/>
<field name="sequence">1</field>
<field name="value">Totally disagree</field>
</record>
<record model="survey.label" id="fcol_2_2_2">
<field name="question_id" ref="feedback_2_2"/>
<field name="sequence">2</field>
<field name="value">Disagree</field>
</record>
<record model="survey.label" id="fcol_2_2_3">
<field name="question_id" ref="feedback_2_2"/>
<field name="sequence">3</field>
<field name="value">Agree</field>
</record>
<record model="survey.label" id="fcol_2_2_4">
<field name="question_id" ref="feedback_2_2"/>
<field name="sequence">4</field>
<field name="value">Totally agree</field>
</record>
<record model="survey.label" id="frow_2_2_1">
<field name="question_id_2" ref="feedback_2_2"/>
<field name="sequence">1</field>
<field name="value">They help new users to understand OpenERP</field>
</record>
<record model="survey.label" id="frow_2_2_2">
<field name="question_id_2" ref="feedback_2_2"/>
<field name="sequence">2</field>
<field name="value">They are clean and correct</field>
</record>
<record model="survey.label" id="frow_2_2_3">
<field name="question_id_2" ref="feedback_2_2"/>
<field name="sequence">3</field>
<field name="value">They are useful on a daily usage</field>
</record>
<record model="survey.label" id="frow_2_2_4">
<field name="question_id_2" ref="feedback_2_2"/>
<field name="sequence">4</field>
<field name="value">A process is defined for all enterprise flows</field>
</record>
<record model="survey.label" id="frow_2_2_5">
<field name="question_id_2" ref="feedback_2_2"/>
<field name="sequence">5</field>
<field name="value">It's easy to find the process you need</field>
</record>
<record model="survey.question" id="feedback_2_3">
<field name="page_id" ref="feedback_2" />
<field name="sequence">3</field>
<field name="question">Do you have suggestions on how to improve the process view ?</field>
<field name="type">free_text</field>
</record>
<record model="survey.question" id="feedback_2_4">
<field name="page_id" ref="feedback_2" />
<field name="sequence">4</field>
<field name="question">What do you think about the structure of the menus?</field>
<field name="type">multiple_choice</field>
<field name="column_nb">4</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="choice_2_4_1">
<field name="question_id" ref="feedback_2_4"/>
<field name="sequence">1</field>
<field name="value">The current menu structure is good</field>
</record>
<record model="survey.label" id="choice_2_4_2">
<field name="question_id" ref="feedback_2_4"/>
<field name="sequence">2</field>
<field name="value">It can be improved</field>
</record>
<record model="survey.label" id="choice_2_4_3">
<field name="question_id" ref="feedback_2_4"/>
<field name="sequence">3</field>
<field name="value">There are too much menus, it's complex to understand</field>
</record>
<record model="survey.question" id="feedback_2_5">
<field name="page_id" ref="feedback_2" />
<field name="sequence">5</field>
<field name="question">What do you think about the groups of users?</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="fcol_2_5_1">
<field name="question_id" ref="feedback_2_5"/>
<field name="sequence">1</field>
<field name="value">Totally disagree</field>
</record>
<record model="survey.label" id="fcol_2_5_2">
<field name="question_id" ref="feedback_2_5"/>
<field name="sequence">2</field>
<field name="value">Disagree</field>
</record>
<record model="survey.label" id="fcol_2_5_3">
<field name="question_id" ref="feedback_2_5"/>
<field name="sequence">3</field>
<field name="value">Agree</field>
</record>
<record model="survey.label" id="fcol_2_5_4">
<field name="question_id" ref="feedback_2_5"/>
<field name="sequence">4</field>
<field name="value">Totally agree</field>
</record>
<record model="survey.label" id="frow_2_5_1">
<field name="question_id_2" ref="feedback_2_5"/>
<field name="sequence">1</field>
<field name="value">The security rules defined on groups are useful</field>
</record>
<record model="survey.label" id="frow_2_5_2">
<field name="question_id_2" ref="feedback_2_5"/>
<field name="sequence">2</field>
<field name="value">Those security rules are standard and can be used out-of-the-box in most cases</field>
</record>
<record model="survey.label" id="frow_2_5_3">
<field name="question_id_2" ref="feedback_2_5"/>
<field name="sequence">3</field>
<field name="value">The 'Usability/Extended View' group helps in daily work</field>
</record>
<record model="survey.label" id="frow_2_5_4">
<field name="question_id_2" ref="feedback_2_5"/>
<field name="sequence">4</field>
<field name="value">The 'Usability/Extended View' group hides only optional fields</field>
</record>
<record model="survey.label" id="frow_2_5_5">
<field name="question_id_2" ref="feedback_2_5"/>
<field name="sequence">5</field>
<field name="value">The groups set on menu items are relevant</field>
</record>
<record model="survey.question" id="feedback_2_6">
<field name="page_id" ref="feedback_2" />
<field name="sequence">6</field>
<field name="question">What do you think about the structure of the menus?</field>
<field name="type">simple_choice</field>
<field name="display_mode">columns</field>
<field name="column_nb">4</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="choice_2_6_1">
<field name="question_id" ref="feedback_2_6"/>
<field name="sequence">1</field>
<field name="value">There are too many groups defined, security is too complex to set</field>
</record>
<record model="survey.label" id="choice_2_6_2">
<field name="question_id" ref="feedback_2_6"/>
<field name="sequence">2</field>
<field name="value">There are too few groups defined, security isn't accurate enough</field>
</record>
<record model="survey.label" id="choice_2_6_3">
<field name="question_id" ref="feedback_2_6"/>
<field name="sequence">3</field>
<field name="value">The number of groups is good</field>
</record>
<record model="survey.question" id="feedback_2_7">
<field name="page_id" ref="feedback_2" />
<field name="sequence">7</field>
<field name="question">What do you think about configuration wizards?</field>
<field name="type">matrix</field>
<field name="matrix_subtype">simple</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="fcol_2_7_1">
<field name="question_id" ref="feedback_2_7"/>
<field name="sequence">1</field>
<field name="value">Totally disagree</field>
</record>
<record model="survey.label" id="fcol_2_7_2">
<field name="question_id" ref="feedback_2_7"/>
<field name="sequence">2</field>
<field name="value">Disagree</field>
</record>
<record model="survey.label" id="fcol_2_7_3">
<field name="question_id" ref="feedback_2_7"/>
<field name="sequence">3</field>
<field name="value">Agree</field>
</record>
<record model="survey.label" id="fcol_2_7_4">
<field name="question_id" ref="feedback_2_7"/>
<field name="sequence">4</field>
<field name="value">Totally agree</field>
</record>
<record model="survey.label" id="frow_2_7_1">
<field name="question_id_2" ref="feedback_2_7"/>
<field name="sequence">1</field>
<field name="value">Descriptions and help tooltips are clear enough</field>
</record>
<record model="survey.label" id="frow_2_7_2">
<field name="question_id_2" ref="feedback_2_7"/>
<field name="sequence">2</field>
<field name="value">Configuration wizard exists for each important setting</field>
</record>
<record model="survey.label" id="frow_2_7_3">
<field name="question_id_2" ref="feedback_2_7"/>
<field name="sequence">3</field>
<field name="value">Extra modules proposed are relevant</field>
</record>
<record model="survey.label" id="frow_2_7_4">
<field name="question_id_2" ref="feedback_2_7"/>
<field name="sequence">4</field>
<field name="value">Running the configuration wizards is a good way to spare time</field>
</record>
<!-- Page 3 -->
<record model="survey.page" id="feedback_3">
<field name="title">Community and contributors</field>
<field name="survey_id" ref="feedback_form" />
<field name="sequence">3</field>
<field name="description">&lt;p&gt;&lt;/p&gt;</field>
</record>
<record model="survey.question" id="feedback_3_1">
<field name="page_id" ref="feedback_3" />
<field name="sequence">1</field>
<field name="question">How do you contribute or plan to contribute to OpenERP?</field>
<field name="type">multiple_choice</field>
<field name="column_nb">6</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.label" id="choice_3_1_1">
<field name="question_id" ref="feedback_3_1"/>
<field name="sequence">1</field>
<field name="value">I participate to discussion and forums</field>
</record>
<record model="survey.label" id="choice_3_1_2">
<field name="question_id" ref="feedback_3_1"/>
<field name="sequence">2</field>
<field name="value">I'd like to contribute but I don't know how?</field>
</record>
<record model="survey.label" id="choice_3_1_3">
<field name="question_id" ref="feedback_3_1"/>
<field name="sequence">3</field>
<field name="value">I develop new features</field>
</record>
<record model="survey.label" id="choice_3_1_4">
<field name="question_id" ref="feedback_3_1"/>
<field name="sequence">4</field>
<field name="value">I help to translate</field>
</record>
<record model="survey.label" id="choice_3_1_5">
<field name="question_id" ref="feedback_3_1"/>
<field name="sequence">5</field>
<field name="value">I write documentations</field>
</record>
<record model="survey.question" id="feedback_3_2">
<field name="page_id" ref="feedback_3" />
<field name="sequence">2</field>
<field name="question">Do you have a proposition to help people to contribute?</field>
<field name="type">free_text</field>
</record>
<record model="survey.question" id="feedback_3_3">
<field name="page_id" ref="feedback_3" />
<field name="sequence">3</field>
<field name="question">Do you have a proposition to attract new contributors?</field>
<field name="type">free_text</field>
</record>
<!-- Page 4 -->
<record model="survey.page" id="feedback_4">
<field name="title">Questions for developers</field>
<field name="survey_id" ref="feedback_form" />
<field name="sequence">4</field>
<field name="description">&lt;p&gt;If you do not contribute or develop in OpenERP, skip this page.&lt;/p&gt;</field>
</record>
<record model="survey.question" id="feedback_4_1">
<field name="page_id" ref="feedback_4" />
<field name="sequence">1</field>
<field name="question">Where do you develop your new features?</field>
<field name="type">multiple_choice</field>
<field name="column_nb">6</field>
</record>
<record model="survey.label" id="choice_4_1_1">
<field name="question_id" ref="feedback_4_1"/>
<field name="sequence">1</field>
<field name="value">I use Launchpad, like all official OpenERP projects</field>
</record>
<record model="survey.label" id="choice_4_1_2">
<field name="question_id" ref="feedback_4_1"/>
<field name="sequence">2</field>
<field name="value">I use another repository system (SourceForge...)</field>
</record>
<record model="survey.label" id="choice_4_1_3">
<field name="question_id" ref="feedback_4_1"/>
<field name="sequence">3</field>
<field name="value">I host them on my own website</field>
</record>
<record model="survey.label" id="choice_4_1_4">
<field name="question_id" ref="feedback_4_1"/>
<field name="sequence">4</field>
<field name="value">I do not publish my developments</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Grant survey permissions to demo user -->
<record id="base.user_demo" model="res.users">
<field eval="[(4, ref('base.group_survey_manager'))]" name="groups_id"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<!-- Standard stages for surveys -->
<record id="stage_draft" model="survey.stage">
<field name="name">Draft</field>
<field name="sequence" eval="1" />
<field name="closed" eval="False" />
<field name="fold" eval="False" />
</record>
<record id="stage_in_progress" model="survey.stage">
<field name="name">In progress</field>
<field name="sequence" eval="2" />
<field name="closed" eval="False" />
<field name="fold" eval="False" />
</record>
<record id="stage_closed" model="survey.stage">
<field name="name">Closed</field>
<field name="sequence" eval="3" />
<field name="closed" eval="True" />
<field name="fold" eval="True" />
</record>
<record id="stage_permanent" model="survey.stage">
<field name="name">Permanent</field>
<field name="sequence" eval="4" />
<field name="closed" eval="False" />
<field name="fold" eval="True" />
</record>
</data>
</openerp>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,433 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import openerp
from openerp import tools
from openerp.report import report_sxw
from openerp.report.interface import report_rml
from openerp.tools import to_xml
class survey_analysis(report_rml):
def create(self, cr, uid, ids, datas, context):
registry = openerp.registry(cr.dbname)
surv_obj = registry['survey']
user_obj = registry['res.users']
rml_obj=report_sxw.rml_parse(cr, uid, surv_obj._name,context)
company=user_obj.browse(cr,uid,[uid],context)[0].company_id
rml ="""<document filename="Survey Analysis Report.pdf">
<template pageSize="(595.0,842.0)" title="Survey Analysis" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate>
<frame id="first" x1="1.3cm" y1="1.5cm" width="18.4cm" height="26.5cm"/>
<pageGraphics>
<fill color="black"/>
<stroke color="black"/>
<setFont name="DejaVuSans" size="8"/>
<drawString x="1.3cm" y="28.3cm"> """+to_xml(rml_obj.formatLang(time.strftime("%Y-%m-%d %H:%M:%S"),date_time=True))+"""</drawString>
<setFont name="DejaVuSans-Bold" size="10"/>
<drawString x="9.8cm" y="28.3cm">"""+ to_xml(company.name) +"""</drawString>
<stroke color="#000000"/>
<lines>1.3cm 28.1cm 20cm 28.1cm</lines>
</pageGraphics>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="2,-1"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_heading">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_head_2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="answer_right" alignment="RIGHT" fontName="Helvetica" fontSize="09.0" leftIndent="2.0"/>
<paraStyle name="Standard1" fontName="Helvetica-Bold" alignment="RIGHT" fontSize="09.0"/>
<paraStyle name="Standard" alignment="LEFT" fontName="Helvetica-Bold" fontSize="11.0"/>
<paraStyle name="header1" fontName="Helvetica" fontSize="11.0"/>
<paraStyle name="response" fontName="Helvetica-Oblique" fontSize="9.5"/>
<paraStyle name="response-bold" fontName="Helvetica-Bold" fontSize="9" alignment="RIGHT" />
<paraStyle name="page" fontName="Helvetica" fontSize="11.0" leftIndent="0.0"/>
<paraStyle name="question" fontName="Helvetica-BoldOblique" fontSize="10.0" leftIndent="3.0"/>
<paraStyle name="answer_bold" fontName="Helvetica-Bold" fontSize="09.0" leftIndent="2.0"/>
<paraStyle name="answer" fontName="Helvetica" fontSize="09.0" leftIndent="2.0"/>
<paraStyle name="title" fontName="Helvetica" fontSize="20.0" leading="15" spaceBefore="6.0" spaceAfter="6.0" alignment="CENTER"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Center_heading" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
</stylesheet>
<images/>
"""
if datas.has_key('form') and datas['form']['survey_ids']:
ids = datas['form']['survey_ids']
for survey in surv_obj.browse(cr, uid, ids):
rml += """<story>
<para style="title">Answers Summary</para>
<para style="Standard"><font></font></para>
<para style="P2">
<font color="white"> </font>
</para>
<blockTable colWidths="280.0,100.0,120.0" style="Table_heading">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Survey Title </para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Total Started Survey </para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Total Completed Survey </para>
</td>
</tr>
</blockTable>
<blockTable colWidths="280.0,100.0,120.0" style="Table_head_2">
<tr>
<td>
<para style="terp_default_Centre_8">""" + to_xml(tools.ustr(survey.title)) + """</para>
</td>
<td>
<para style="terp_default_Centre_8">""" + str(survey.tot_start_survey) + """</para>
</td>
<td>
<para style="terp_default_Centre_8">""" + str(survey.tot_comp_survey) + """</para>
</td>
</tr>
</blockTable>
<para style="P2">
<font color="white"> </font>
</para>"""
for page in survey.page_ids:
rml += """ <blockTable colWidths="500" style="Table4">
<tr>
<td><para style="page">Page :- """ + to_xml(tools.ustr(page.title)) + """</para></td>
</tr>
</blockTable>"""
for que in page.question_ids:
rml +="""<blockTable colWidths="500" style="Table5">
<tr>
<td><para style="question">""" + to_xml(tools.ustr(que.question)) + """</para></td>
</tr>
</blockTable>"""
cols_widhts = []
if que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans']:
cols_widhts.append(200)
for col in range(0, len(que.column_heading_ids) + 1):
cols_widhts.append(float(300 / (len(que.column_heading_ids) + 1)))
colWidths = ",".join(map(tools.ustr, cols_widhts))
matrix_ans = [(0,'')]
for col in que.column_heading_ids:
if col.title not in matrix_ans:
matrix_ans.append((col.id,col.title))
rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
for mat_col in range(0, len(matrix_ans)):
rml+="""<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
rml += """<td><para style="response-bold">Answer Count</para></td>
</tr>"""
last_col = cols_widhts[-1]
for ans in que.answer_choice_ids:
rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
cr.execute("select count(id) from survey_response_answer sra where sra.answer_id = %s", (ans.id,))
tot_res = cr.fetchone()[0]
cr.execute("select count(id) ,sra.column_id from survey_response_answer sra where sra.answer_id=%s group by sra.column_id", (ans.id,))
calc_res = cr.dictfetchall()
for mat_col in range(1, len(matrix_ans)):
percantage = 0.0
cal_count = 0
for cal in calc_res:
if cal['column_id'] == matrix_ans[mat_col][0]:
cal_count = cal['count']
if tot_res:
percantage = round(float(cal_count)*100 / tot_res,2)
if percantage:
rml += """<td color="#FFF435"><para style="answer_bold">""" + tools.ustr(percantage) +"% (" + tools.ustr(cal_count) + """)</para></td>"""
else:
rml += """<td color="#FFF435"><para style="answer">""" + tools.ustr(percantage) +"% (" + tools.ustr(cal_count) + """)</para></td>"""
rml += """<td><para style="answer_right">""" + tools.ustr(tot_res) + """</para></td>
</tr>"""
rml += """</blockTable>"""
if que.is_comment_require:
cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''",(que.id,))
tot_res = cr.fetchone()[0]
rml += """<blockTable colWidths=" """+ str(500 - last_col) +"," + str(last_col) + """ " style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
elif que.type in['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans', 'multiple_textboxes','date_and_time','date','multiple_textboxes_diff_type']:
rml += """<blockTable colWidths="240.0,210,50.0" style="Table1">"""
rml += """ <tr>
<td> <para style="Standard"> </para></td>
<td> <para style="terp_default_Center_heading">Answer Percentage</para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>"""
for ans in que.answer_choice_ids:
progress = ans.average * 7 / 100
rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
<td>
<illustration>
<stroke color="lightslategray"/>
<rect x="0.1cm" y="-0.45cm" width="7.2 cm" height="0.5cm" fill="no" stroke="yes" round="0.1cm"/>
"""
if progress:
rml += """<fill color="lightsteelblue"/>
<rect x="0.2cm" y="-0.35cm" width='""" + tools.ustr(str(float(progress)) +'cm') + """' height="0.3cm" fill="yes" stroke="no" round="0.1cm"/>"""
rml += """
<fill color="black"/>
<setFont name="Helvetica" size="9"/>
<drawString x="3.2cm" y="-0.30cm">""" + tools.ustr(ans.average) + """%</drawString></illustration>
</td>
<td><para style="answer_right">""" + tools.ustr(ans.response) + """</para></td></tr>"""
rml += """</blockTable>"""
if que.is_comment_require:
# if que.make_comment_field:
# cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
# tot_res = cr.fetchone()[0]
# tot_avg = 0.00
# if que.tot_resp:
# tot_avg = round(float(tot_res * 100)/ que.tot_resp,2)
# rml+="""<blockTable colWidths="280.0,120,100.0" style="Table1"><tr><td><para style="answer">""" +to_xml(tools.ustr(que.comment_label)) + """</para></td>
# <td><para style="answer">""" + str(tot_avg) + """%</para></td>
# <td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
# else:
cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
tot_res = cr.fetchone()[0]
rml += """<blockTable colWidths="450.0,50.0" style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
<td><para style="answer_right">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
elif que.type in['single_textbox']:
cr.execute("select count(id) from survey_response_line where question_id = %s and single_text!=''",(que.id,))
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
<tr>
<td> <para style="Standard"> </para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>
<tr><td><para style="answer"></para></td>
<td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
</blockTable>"""
elif que.type in['comment']:
cr.execute("select count(id) from survey_response_line where question_id = %s and comment !=''", (que.id,))
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
<tr>
<td> <para style="Standard"> </para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>
<tr><td><para style="answer"></para></td>
<td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
</blockTable>"""
elif que.type in['rating_scale']:
cols_widhts.append(200)
for col in range(0,len(que.column_heading_ids) + 2):
cols_widhts.append(float(300 / (len(que.column_heading_ids) + 2)))
colWidths = ",".join(map(tools.ustr, cols_widhts))
matrix_ans = [(0,'')]
for col in que.column_heading_ids:
if col.title not in matrix_ans:
matrix_ans.append((col.id,col.title))
rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
for mat_col in range(0,len(matrix_ans)):
rml += """<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
rml += """<td><para style="response-bold">Rating Average</para></td>
<td><para style="response-bold">Answer Count</para></td>
</tr>"""
for ans in que.answer_choice_ids:
rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
res_count = 0
rating_weight_sum = 0
for mat_col in range(1, len(matrix_ans)):
cr.execute("select count(sra.answer_id) from survey_response_line sr, survey_response_answer sra\
where sr.id = sra.response_id and sra.answer_id = %s and sra.column_id ='%s'", (ans.id,matrix_ans[mat_col][0]))
tot_res = cr.fetchone()[0]
cr.execute("select count(sra.answer_id),sqc.rating_weight from survey_response_line sr, survey_response_answer sra ,\
survey_question_column_heading sqc where sr.id = sra.response_id and \
sqc.question_id = sr.question_id and sra.answer_id = %s and sqc.title ='%s'\
+ group by sra.answer_id,sqc.rating_weight", (ans.id,matrix_ans[mat_col][1]))
col_weight = cr.fetchone()
if not col_weight:
col_weight= (0,0)
elif not col_weight[1]:
col_weight = (col_weight[0],0)
res_count = col_weight[0]
if tot_res and res_count:
rating_weight_sum += int(col_weight[1]) * tot_res
tot_per = round((float(tot_res) * 100) / int(res_count), 2)
else:
tot_per = 0.0
if tot_res:
rml += """<td><para style="answer_bold">""" + tools.ustr(tot_per) + "%(" + tools.ustr(tot_res) + """)</para></td>"""
else:
rml += """<td><para style="answer">""" + tools.ustr(tot_per)+"%(" + tools.ustr(tot_res) + """)</para></td>"""
percantage = 0.00
if res_count:
percantage = round((float(rating_weight_sum)/res_count), 2)
rml += """<td><para style="answer_right">""" + tools.ustr(percantage) + """</para></td>
<td><para style="answer_right">""" + tools.ustr(res_count) + """</para></td></tr>"""
rml += """</blockTable>"""
elif que.type in['matrix_of_drop_down_menus']:
for column in que.column_heading_ids:
rml += """<blockTable colWidths="500" style="Table1"><tr>
<td><para style="answer">""" + to_xml(tools.ustr(column.title)) + """</para></td></tr></blockTable>"""
menu_choices = column.menu_choice.split('\n')
cols_widhts = []
cols_widhts.append(200)
for col in range(0, len(menu_choices) + 1):
cols_widhts.append(float(300 / (len(menu_choices) + 1)))
colWidths = ",".join(map(tools.ustr, cols_widhts))
rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>
<td><para style="response"></para></td>"""
for menu in menu_choices:
rml += """<td><para style="response">""" + to_xml(tools.ustr(menu)) + """</para></td>"""
rml += """<td><para style="response-bold">Answer Count</para></td></tr>"""
cr.execute("select count(id), sra.answer_id from survey_response_answer sra \
where sra.column_id='%s' group by sra.answer_id ", (column.id,))
res_count = cr.dictfetchall()
cr.execute("select count(sra.id),sra.value_choice, sra.answer_id, sra.column_id from survey_response_answer sra \
where sra.column_id='%s' group by sra.value_choice ,sra.answer_id, sra.column_id", (column.id,))
calc_percantage = cr.dictfetchall()
for ans in que.answer_choice_ids:
rml += """<tr><td><para style="answer_right">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
for mat_col in range(0, len(menu_choices)):
calc = 0
response = 0
for res in res_count:
if res['answer_id'] == ans.id: response = res['count']
for per in calc_percantage:
if ans.id == per['answer_id'] and menu_choices[mat_col] == per['value_choice']:
calc = per['count']
percantage = 0.00
if calc and response:
percantage = round((float(calc)* 100) / response,2)
if calc:
rml += """<td><para style="answer_bold">""" +tools.ustr(percantage)+"% (" + tools.ustr(calc) + """)</para></td>"""
else:
rml += """<td><para style="answer">""" +tools.ustr(percantage)+"% (" + tools.ustr(calc) + """)</para></td>"""
response = 0
for res in res_count:
if res['answer_id'] == ans.id: response = res['count']
rml += """<td><para style="answer_right">""" + tools.ustr(response) + """</para></td></tr>"""
rml += """</blockTable>"""
elif que.type in['numerical_textboxes']:
rml += """<blockTable colWidths="240.0,20,100.0,70,70.0" style="Table1">
<tr>
<td> <para style="Standard"> </para></td>
<td> <para style="Standard"> </para></td>
<td> <para style="response">Answer Average</para></td>
<td> <para style="response">Answer Total</para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>"""
for ans in que.answer_choice_ids:
cr.execute("select answer from survey_response_answer where answer_id=%s group by answer", (ans.id,))
tot_res = cr.dictfetchall()
total = 0
for tot in tot_res:
total += int(tot['answer'])
per = 0.00
if len(tot_res):
per = round((float(total) / len(tot_res)),2)
rml+="""<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
<td> <para style="Standard"> </para></td>
<td> <para style="answer">""" + tools.ustr(per) +"""</para></td>
<td><para style="answer">""" + tools.ustr(total) + """</para></td>
<td><para style="answer_right">""" + tools.ustr(len(tot_res)) + """</para></td></tr>"""
rml+="""</blockTable>"""
rml +="""<blockTable colWidths="300,100,100.0" style="Table3">
<tr>
<td><para style="Standard1"></para></td>
<td><para style="Standard1">Answered Question</para></td>
<td><para style="Standard1">""" + tools.ustr(que.tot_resp) + """</para></td>
</tr>
<tr>
<td><para style="Standard1"></para></td>
<td><para style="Standard1">Skipped Question</para></td>
<td><para style="Standard1">""" + tools.ustr(survey.tot_start_survey - que.tot_resp) + """</para></td>
</tr>
</blockTable>"""
rml += """</story>"""
rml += """</document>"""
report_type = datas.get('report_type', 'pdf')
create_doc = self.generators[report_type]
self.internal_header=True
pdf = create_doc(rml, title=self.title)
return (pdf, report_type)
survey_analysis('report.survey.analysis', 'survey','','')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,542 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import openerp
from openerp import tools
from openerp.report import report_sxw
from openerp.report.interface import report_rml
from openerp.tools import to_xml
from openerp.tools.translate import _
class survey_browse_response(report_rml):
def create(self, cr, uid, ids, datas, context):
_divide_columns_for_matrix = 0.7
_display_ans_in_rows = 5
_pageSize = ('29.7cm','21.1cm')
registry = openerp.registry(cr.dbname)
if datas.has_key('form') and datas['form'].get('orientation','') == 'vertical':
if datas['form'].get('paper_size','') == 'letter':
_pageSize = ('21.6cm','27.9cm')
elif datas['form'].get('paper_size','') == 'legal':
_pageSize = ('21.6cm','35.6cm')
elif datas['form'].get('paper_size','') == 'a4':
_pageSize = ('21.1cm','29.7cm')
elif datas.has_key('form') and datas['form'].get('orientation',False) == 'horizontal':
if datas['form'].get('paper_size','') == 'letter':
_pageSize = ('27.9cm','21.6cm')
elif datas['form'].get('paper_size','') == 'legal':
_pageSize = ('35.6cm','21.6cm')
elif datas['form'].get('paper_size') == 'a4':
_pageSize = ('29.7cm','21.1cm')
_frame_width = tools.ustr(_pageSize[0])
_frame_height = tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.90))+'cm'
_tbl_widths = tools.ustr(float(_pageSize[0].replace('cm','')) - float(2.10))+'cm'
rml ="""<document filename="Survey Answer Report.pdf">
<template pageSize="("""+_pageSize[0]+""","""+_pageSize[1]+""")" title='Survey Answer' author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20" >
<pageTemplate id="first">
<frame id="first" x1="0.0cm" y1="1.0cm" width='"""+_frame_width+"""' height='"""+_frame_height+"""'/>
<pageGraphics>
<lineMode width="1.0"/>
<lines>1.0cm """+tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00))+'cm'+"""</lines>
<lines>1.0cm """+tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00))+'cm'+""" 1.0cm 1.00cm</lines>
<lines>"""+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" 1.00cm</lines>
<lines>1.0cm 1.00cm """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" 1.00cm</lines>"""
if datas.has_key('form') and datas['form']['page_number']:
rml +="""
<fill color="gray"/>
<setFont name="Helvetica" size="10"/>
<drawRightString x='"""+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+"""' y="0.6cm">"""+_('Page : ')+"""<pageNumber/> </drawRightString>"""
rml +="""</pageGraphics>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="tbl_white">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="tbl_gainsboro">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
<blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="ans_tbl_white">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="ans_tbl_gainsboro">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="simple_table">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6"/>
</blockTableStyle>
<blockTableStyle id="note_table">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="2,-1"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table41">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table51">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_heading">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="title_tbl">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
<blockBackground colorName="black" start="0,0" stop="-1,-1"/>
<blockTextColor colorName="white" start="0,0" stop="0,0"/>
</blockTableStyle>
<blockTableStyle id="page_tbl">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
<blockBackground colorName="gray" start="0,0" stop="-1,-1"/>
<blockTextColor colorName="white" start="0,0" stop="0,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="title" fontName="Helvetica-Bold" fontSize="18.0" leftIndent="0.0" textColor="white"/>
<paraStyle name="answer_right" alignment="RIGHT" fontName="Helvetica" fontSize="09.0" leftIndent="2.0"/>
<paraStyle name="Standard1" fontName="Helvetica-Bold" alignment="RIGHT" fontSize="09.0"/>
<paraStyle name="Standard" alignment="LEFT" fontName="Helvetica-Bold" fontSize="11.0"/>
<paraStyle name="header1" fontName="Helvetica" fontSize="11.0"/>
<paraStyle name="response" fontName="Helvetica-Oblique" fontSize="9.5"/>
<paraStyle name="page" fontName="Helvetica" fontSize="11.0" leftIndent="0.0"/>
<paraStyle name="question" fontName="Helvetica-BoldOblique" fontSize="10.0" leftIndent="3.0"/>
<paraStyle name="answer_Bold" fontName="Helvetica-Bold" fontSize="09.0" leftIndent="2.0"/>
<paraStyle name="answer" fontName="Helvetica" fontSize="09.0" leftIndent="2.0"/>
<paraStyle name="answer1" fontName="Helvetica" fontSize="09.0" leftIndent="2.0"/>
<paraStyle name="Title" fontName="Helvetica" fontSize="20.0" leading="15" spaceBefore="6.0" spaceAfter="6.0" alignment="CENTER"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="comment" fontName="Helvetica" fontSize="14.0" leading="50" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="12" spaceBefore="0.0" spaceAfter="1.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre_simple" fontName="Helvetica" fontSize="10.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="10.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_right_simple" fontName="Helvetica" fontSize="10.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_right" fontName="Helvetica-Bold" fontSize="10.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="descriptive_text" fontName="Helvetica-Bold" fontSize="18.0" leftIndent="0.0" textColor="white"/>
<paraStyle name="descriptive_text_heading" fontName="Helvetica-Bold" fontSize="18.0" alignment="RIGHT" leftIndent="0.0" textColor="white"/>
</stylesheet>
<images/>
<story>"""
surv_resp_obj = registry['survey.response']
rml_obj=report_sxw.rml_parse(cr, uid, surv_resp_obj._name,context)
if datas.has_key('form') and datas['form'].has_key('response_ids'):
response_id = datas['form']['response_ids']
elif context.has_key('response_id') and context['response_id']:
response_id = [int(context['response_id'][0])]
else:
response_id = surv_resp_obj.search(cr, uid, [('survey_id', 'in', ids)])
surv_resp_line_obj = registry['survey.response.line']
surv_obj = registry['survey']
for response in surv_resp_obj.browse(cr, uid, response_id):
for survey in surv_obj.browse(cr, uid, [response.survey_id.id]):
tbl_width = float(_tbl_widths.replace('cm', ''))
colwidth = "2.5cm,4.8cm," + str(tbl_width - 15.0) +"cm,3.2cm,4.5cm"
resp_create = tools.ustr(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S')))
rml += """<blockTable colWidths='""" + colwidth + """' style="Table_heading">
<tr>
<td><para style="terp_default_9_Bold">""" + _('Print Date : ') + """</para></td>
<td><para style="terp_default_9">""" + to_xml(rml_obj.formatLang(time.strftime("%Y-%m-%d %H:%M:%S"),date_time=True)) + """</para></td>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9_Bold">""" +_('Answered by : ') + """</para></td>
<td><para style="terp_default_9">""" + to_xml(response.user_id.login or '') + """</para></td>
</tr>
<tr>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9_Bold">""" +_('Answer Date : ') + """</para></td>
<td><para style="terp_default_9">""" + to_xml(resp_create) + """</para></td>
</tr>
</blockTable><para style="P2"></para>"""
status = _("Not Finished")
if response.state == "done": status = _("Finished")
colwidth = str(tbl_width - 7) + "cm,"
colwidth += "7cm"
rml += """<blockTable colWidths='""" + str(colwidth) + """' style="title_tbl">
<tr>
<td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td>
<td><para style="descriptive_text_heading">"""+_('Status :- ')+ to_xml(tools.ustr(status)) + """</para><para style="P2"><font></font></para></td>
</tr>
</blockTable>"""
if survey.note:
rml += """<blockTable colWidths='""" + _tbl_widths + """' style="note_table">
<tr><td><para style="response">""" + to_xml(tools.ustr(survey.note or '')) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
for page in survey.page_ids:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="page_tbl">
<tr><td><para style="page">"""+_('Page :- ') + to_xml(tools.ustr(page.title or '')) + """</para></td></tr>
</blockTable>"""
if page.note:
rml += """<para style="P2"></para>
<blockTable colWidths='""" + str(_tbl_widths) + """' style="note_table">
<tr><td><para style="response">""" + to_xml(tools.ustr(page.note or '')) + """</para></td></tr>
</blockTable>"""
for que in page.question_ids:
rml += """<para style="P2"></para>
<blockTable colWidths='""" + str(_tbl_widths) + """' style="Table5">
<tr><td><para style="question">""" + to_xml(to_xml(que.question)) + """</para></td></tr>
</blockTable>"""
answer = surv_resp_line_obj.browse(cr ,uid, surv_resp_line_obj.search(cr, uid, [('question_id', '=', que.id),('response_id', '=', response.id)]))
if que.type in ['descriptive_text']:
rml +="""<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">""" + to_xml(tools.ustr(que.descriptive_text)) + """</para></td> </tr>
</blockTable>"""
elif que.type in ['table']:
if len(answer) and answer[0].state == "done":
col_heading = registry['survey.tbl.column.heading']
cols_widhts = []
tbl_width = float(_tbl_widths.replace('cm', ''))
for i in range(0, len(que.column_heading_ids)):
cols_widhts.append(tbl_width / float(len(que.column_heading_ids)))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = colWidths + 'cm'
matrix_ans = []
rml +="""<para style="P2"></para><blockTable colWidths=" """ + str(colWidths) + """ " style="Table41"><tr>"""
for col in que.column_heading_ids:
if col.title not in matrix_ans:
matrix_ans.append(col.title)
rml += """<td> <para style="terp_tblheader_Details">""" + to_xml(tools.ustr(col.title)) +"""</para></td>"""
rml += """</tr></blockTable>"""
i = 0
for row in range(0, que.no_of_rows):
if i%2 != 0:
style = 'tbl_white'
else:
style = 'tbl_gainsboro'
i +=1
rml += """<blockTable colWidths=" """ + str(colWidths) + """ " style='"""+style+"""'><tr>"""
table_data = col_heading.browse(cr, uid, col_heading.search(cr, uid, [('response_table_id', '=', answer[0].id), ('name', '=', row)]))
for column in matrix_ans:
value = False
for col in table_data:
if column == col.column_id.title:
value = col.value
if value:
rml += """<td> <para style="terp_default_9">""" + to_xml(tools.ustr(value)) +"""</para></td>"""
else:
rml += """<td><para style="terp_default_9"><font color ="white"> </font></para></td>"""
rml += """</tr></blockTable>"""
else:
rml +="""<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">"""+ _('No Answer') + """</para></td> </tr>
</blockTable>"""
elif que.type in ['multiple_choice_only_one_ans','multiple_choice_multiple_ans']:
if len(answer) and answer[0].state == "done":
ans_list = []
for ans in answer[0].response_answer_ids:
ans_list.append(to_xml(tools.ustr(ans.answer_id.answer)))
answer_choice=[]
for ans in que['answer_choice_ids']:
answer_choice.append(to_xml(tools.ustr((ans.answer))))
def divide_list(lst, n):
return [lst[i::n] for i in range(n)]
divide_list = divide_list(answer_choice,_display_ans_in_rows)
for lst in divide_list:
if que.type == 'multiple_choice_multiple_ans':
if len(lst) <> 0 and len(lst) <> int(round(float(len(answer_choice)) / _display_ans_in_rows, 0)):
lst.append('')
if not lst:
del divide_list[divide_list.index(lst):]
for divide in divide_list:
a = _divide_columns_for_matrix * len(divide)
b = float(_tbl_widths.replace('cm', '')) - float(a)
cols_widhts = []
for div in range(0, len(divide)):
cols_widhts.append(float(a / len(divide)))
cols_widhts.append(float(b / len(divide)))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = colWidths +'cm'
rml += """<blockTable colWidths=" """ + colWidths + """ " style="simple_table"><tr>"""
for div in range(0, len(divide)):
if divide[div] != '':
if que.type == 'multiple_choice_multiple_ans':
if divide[div] in ans_list:
rml += """<td><illustration><fill color="white"/>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>
<fill color="gray"/>
<rect x="0.2cm" y="-0.35cm" width="0.3 cm" height="0.3cm" fill="yes" stroke="no" round="0.1cm"/>
</illustration></td>
<td><para style="answer">""" + divide[div] + """</para></td>"""
else:
rml+="""<td><illustration>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="no" stroke="yes" round="0.1cm"/>
</illustration></td>
<td><para style="answer">""" + divide[div] + """</para></td>"""
else:
if divide[div] in ans_list:
rml += """<td><illustration><fill color="white"/>
<circle x="0.3cm" y="-0.18cm" radius="0.22 cm" fill="yes" stroke="yes" round="0.1cm"/>
<fill color="gray"/>
<circle x="0.3cm" y="-0.18cm" radius="0.10 cm" fill="yes" stroke="no" round="0.1cm"/>
</illustration></td>
<td><para style="answer">""" + divide[div] + """</para></td>"""
else:
rml += """<td>
<illustration>
<circle x="0.3cm" y="-0.18cm" radius="0.23 cm" fill="no" stroke="yes" round="0.1cm"/>
</illustration>
</td>
<td><para style="answer">""" + divide[div] + """</para></td>"""
else:
rml += """<td></td><td></td>"""
rml += """</tr></blockTable>"""
if que.is_comment_require and answer[0].comment:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table"><tr>
<td><para style="answer">""" + to_xml(tools.ustr(answer[0].comment)) + """</para></td></tr></blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['multiple_textboxes_diff_type','multiple_textboxes','date','date_and_time','numerical_textboxes','multiple_textboxes_diff_type']:
if len(answer) and answer[0].state == "done":
cols_widhts = []
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = tools.ustr(colWidths) + 'cm'
answer_list = {}
for ans in answer[0].response_answer_ids:
answer_list[ans.answer_id.answer] = ans.answer
for que_ans in que['answer_choice_ids']:
if que_ans.answer in answer_list:
rml += """<blockTable colWidths='""" + str(colWidths) + """' style="simple_table">
<tr> <td> <para style="response">""" + to_xml(tools.ustr(que_ans.answer)) + """</para></td>
<td> <para style="response">""" + to_xml(tools.ustr(answer_list[que_ans.answer])) + """</para></td></tr>
</blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(colWidths) + """' style="simple_table">
<tr> <td> <para style="response">""" + to_xml(tools.ustr(que_ans.answer)) + """</para></td>
<td> <para style="response"></para></td></tr>
</blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['single_textbox']:
if len(answer) and answer[0].state == "done":
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">""" + to_xml(tools.ustr(answer[0].single_text)) + """</para></td></tr>
</blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['comment']:
if len(answer) and answer[0].state == "done":
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">""" + to_xml(tools.ustr(answer[0].comment)) + """</para></td></tr>
</blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans', 'rating_scale', 'matrix_of_drop_down_menus']:
if len(answer) and answer[0].state == "done":
if que.type in ['matrix_of_choices_only_one_ans', 'rating_scale'] and que.comment_column:
pass
cols_widhts = []
if len(que.column_heading_ids):
cols_widhts.append(float(_tbl_widths.replace('cm','')) / float(2.0))
for col in que.column_heading_ids:
cols_widhts.append(float((float(_tbl_widths.replace('cm','')) / float(2.0)) / len(que.column_heading_ids)))
else:
cols_widhts.append(float(_tbl_widths.replace('cm','')))
tmp = 0.0
sum = 0.0
i = 0
if que.type in ['matrix_of_choices_only_one_ans','rating_scale'] and que.comment_column:
for col in cols_widhts:
if i == 0:
cols_widhts[i] = cols_widhts[i] / 2.0
tmp = cols_widhts[i]
sum += col
i += 1
cols_widhts.append(round(tmp, 2))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = colWidths + 'cm'
matrix_ans = [(0, ''),]
for col in que.column_heading_ids:
if col.title not in matrix_ans:
matrix_ans.append((col.id, col.title))
len_matrix = len(matrix_ans)
if que.type in ['matrix_of_choices_only_one_ans', 'rating_scale'] and que.comment_column:
matrix_ans.append((0,que.column_name))
rml += """<blockTable colWidths=" """ + colWidths + """ " style="simple_table"><tr>"""
for mat_col in range(0, len(matrix_ans)):
rml += """<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
rml += """</tr>"""
rml += """</blockTable>"""
i = 0
for ans in que.answer_choice_ids:
if i%2 != 0:
style = 'ans_tbl_white'
else:
style = 'ans_tbl_gainsboro'
i += 1
rml += """<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'>
<tr><td><para style="response">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
comment_value = ""
for mat_col in range(1, len_matrix):
value = """"""
for res_ans in answer[0].response_answer_ids:
if res_ans.answer_id.id == ans.id and res_ans.column_id.id == matrix_ans[mat_col][0]:
comment_value = to_xml(tools.ustr(res_ans.comment_field))
if que.type in ['matrix_of_drop_down_menus']:
value = """<para style="response">""" + to_xml(tools.ustr(res_ans.value_choice)) + """</para>"""
elif que.type in ['matrix_of_choices_only_one_ans', 'rating_scale']:
value = """<illustration><fill color="white"/>
<circle x="0.3cm" y="-0.18cm" radius="0.22 cm" fill="yes" stroke="yes"/>
<fill color="gray"/>
<circle x="0.3cm" y="-0.18cm" radius="0.10 cm" fill="yes" stroke="no"/>
</illustration>"""
elif que.type in ['matrix_of_choices_only_multi_ans']:
value = """<illustration>
<fill color="white"/>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>
<fill color="gray"/>
<rect x="0.2cm" y="-0.35cm" width="0.3 cm" height="0.3cm" fill="yes" stroke="no" round="0.1cm"/>
</illustration>"""
break
else:
if que.type in ['matrix_of_drop_down_menus']:
value = """"""
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
value = """<illustration><fill color="white"/>
<circle x="0.3cm" y="-0.18cm" radius="0.22 cm" fill="yes" stroke="yes" round="0.1cm"/>
</illustration>"""
elif que.type in ['matrix_of_choices_only_multi_ans']:
value = """<illustration><fill color="white"/>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>
</illustration>"""
rml+= """<td>""" + value + """</td>"""
if que.type in ['matrix_of_choices_only_one_ans','rating_scale'] and que.comment_column:
if comment_value == 'False':
comment_value = ''
rml += """<td><para style="response">""" + to_xml(tools.ustr(comment_value)) + """</para></td>"""
rml += """</tr></blockTable>"""
if que.is_comment_require:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table"><tr>
<td><para style="answer">""" + to_xml(tools.ustr(answer[0].comment or '')) + """</para></td></tr></blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
if datas.has_key('form') and not datas['form']['without_pagebreak']:
rml += """<pageBreak/>"""
elif not datas.has_key('form'):
rml += """<pageBreak/>"""
else:
rml += """<para style="P2"><font></font></para>"""
rml += """</story></document>"""
report_type = datas.get('report_type', 'pdf')
create_doc = self.generators[report_type]
pdf = create_doc(rml, title=self.title)
return (pdf, report_type)
survey_browse_response('report.survey.browse.response', 'survey','','')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,397 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import openerp
from openerp import tools
from openerp.report.interface import report_rml
from openerp.tools import to_xml
class survey_form(report_rml):
def create(self, cr, uid, ids, datas, context):
_divide_columns_for_matrix = 0.7
_display_ans_in_rows = 5
_pageSize = ('29.7cm','21.1cm')
if datas.has_key('form') and datas['form'].get('orientation','') == 'vertical':
if datas['form'].get('paper_size','') == 'letter':
_pageSize = ('21.6cm','27.9cm')
elif datas['form'].get('paper_size','') == 'legal':
_pageSize = ('21.6cm','35.6cm')
elif datas['form'].get('paper_size','') == 'a4':
_pageSize = ('21.1cm','29.7cm')
elif datas.has_key('form') and datas['form'].get('orientation','') == 'horizontal':
if datas['form'].get('paper_size','') == 'letter':
_pageSize = ('27.9cm','21.6cm')
elif datas['form'].get('paper_size','') == 'legal':
_pageSize = ('35.6cm','21.6cm')
elif datas['form'].get('paper_size','') == 'a4':
_pageSize = ('29.7cm','21.1cm')
_frame_width = tools.ustr(_pageSize[0])
_frame_height = tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.90))+'cm'
_tbl_widths = tools.ustr(float(_pageSize[0].replace('cm','')) - float(2.10))+'cm'
rml="""<document filename="Survey Form.pdf">
<template pageSize="("""+_pageSize[0]+""","""+_pageSize[1]+""")" title='Survey Form' author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20" >
<pageTemplate id="first">
<frame id="first" x1="0.0cm" y1="1.0cm" width='"""+_frame_width+"""' height='"""+_frame_height+"""'/>
<pageGraphics>
<lineMode width="1.0"/>
<lines>1.0cm """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) + 'cm' + """ """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) + 'cm' + """</lines>
<lines>1.0cm """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) +'cm'+ """ 1.0cm 1.00cm</lines>
<lines>""" + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm' + """ """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00)) + 'cm' + """ 1.00cm</lines>
<lines>1.0cm 1.00cm """ + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" 1.00cm</lines>"""
if datas.has_key('form') and datas['form']['page_number']:
rml +="""
<fill color="gray"/>
<setFont name="Helvetica" size="10"/>
<drawRightString x='""" + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00)) + 'cm' + """' y="0.6cm">Page : <pageNumber/> </drawRightString>"""
rml +="""</pageGraphics>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="ans_tbl">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="tbl_white">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="tbl_gainsboro">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
<blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="ans_tbl_white">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="ans_tbl_gainsboro">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="page_tbl">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
<blockBackground colorName="gray" start="0,0" stop="-1,-1"/>
<blockTextColor colorName="white" start="0,0" stop="0,0"/>
</blockTableStyle>
<blockTableStyle id="title_tbl">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
<blockBackground colorName="black" start="0,0" stop="-1,-1"/>
<blockTextColor colorName="white" start="0,0" stop="0,0"/>
</blockTableStyle>
<blockTableStyle id="question_tbl">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="note_table">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="tbl">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="response" fontName="Helvetica-Oblique" fontSize="9.5"/>
<paraStyle name="page" fontName="Helvetica-Bold" fontSize="15.0" leftIndent="0.0" textColor="white"/>
<paraStyle name="title" fontName="Helvetica-Bold" fontSize="18.0" leading="15" leftIndent="0.0" textColor="white"/>
<paraStyle name="question" fontName="Helvetica-BoldOblique" fontSize="10.0" leftIndent="3.0"/>
<paraStyle name="answer" fontName="Helvetica" fontSize="09.0" leftIndent="0.0"/>
<paraStyle name="descriptive_text" fontName="Helvetica" fontSize="10.0" leftIndent="0.0"/>
<paraStyle name="answer_left" alignment="LEFT" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="comment" fontName="Helvetica" fontSize="14.0" leading="50" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="12" spaceBefore="0.0" spaceAfter="1.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<story>"""
surv_obj = openerp.registry(cr.dbname)['survey']
for survey in surv_obj.browse(cr,uid,ids):
rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
<tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
if survey.note:
rml += """
<para style="P2"></para>
<blockTable colWidths='"""+_tbl_widths+"""' style="note_table">
<tr><td><para style="descriptive_text">""" + to_xml(tools.ustr(survey.note)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
seq = 0
for page in survey.page_ids:
seq += 1
rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="page_tbl">
<tr><td><para style="page">"""+ tools.ustr(seq) + """. """ + to_xml(tools.ustr(page.title)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
if page.note:
rml += """<para style="P2"></para><blockTable colWidths='"""+_tbl_widths+"""' style="note_table">
<tr><td><para style="descriptive_text">""" + to_xml(tools.ustr(page.note or '')) + """</para></td></tr>
</blockTable>"""
for que in page.question_ids:
cols_widhts = []
rml += """
<para style="P2"><font></font></para>
<blockTable colWidths='"""+_tbl_widths+"""' style="question_tbl">
<tr><td><para style="question">""" + to_xml(tools.ustr(que.question)) + """</para></td></tr>
</blockTable>
<para style="P2"><font></font></para>"""
if que.type in ['descriptive_text']:
cols_widhts.append(float(_tbl_widths.replace('cm','')))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = colWidths + 'cm'
rml += """
<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
<tr>
<td>
<para style="descriptive_text">""" + to_xml(tools.ustr(que.descriptive_text)) + """</para>
</td>
</tr>
</blockTable>"""
elif que.type in ['multiple_choice_multiple_ans','multiple_choice_only_one_ans']:
answer = []
for ans in que.answer_choice_ids:
answer.append(to_xml(tools.ustr((ans.answer))))
def divide_list(lst, n):
return [lst[i::n] for i in range(n)]
divide_list = divide_list(answer,_display_ans_in_rows)
for lst in divide_list:
if que.type == 'multiple_choice_multiple_ans':
if len(lst)<>0 and len(lst)<>int(round(float(len(answer))/_display_ans_in_rows,0)):
lst.append('')
if not lst:
del divide_list[divide_list.index(lst):]
for divide in divide_list:
a = _divide_columns_for_matrix*len(divide)
b = float(_tbl_widths.replace('cm','')) - float(a)
cols_widhts = []
for div in range(0,len(divide)):
cols_widhts.append(float(a/len(divide)))
cols_widhts.append(float(b/len(divide)))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = colWidths +'cm'
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
<tr>"""
for div in range(0,len(divide)):
if divide[div] != '':
if que.type == 'multiple_choice_multiple_ans':
rml += """
<td>
<illustration>
<rect x="0.1cm" y="-0.4cm" width="0.5 cm" height="0.5cm" fill="no" stroke="yes"/>
</illustration>
</td>
<td><para style="answer">""" + divide[div] + """</para></td>"""
else:
rml += """
<td>
<illustration>
<circle x="0.3cm" y="-0.18cm" radius="0.23 cm" fill="no" stroke="yes"/>
</illustration>
</td>
<td><para style="answer">""" + divide[div] + """</para></td>"""
else:
rml += """
<td></td>
<td></td>"""
rml += """
</tr></blockTable>"""
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale','matrix_of_choices_only_multi_ans','matrix_of_drop_down_menus']:
if len(que.column_heading_ids):
cols_widhts.append(float(_tbl_widths.replace('cm',''))/float(2.0))
for col in que.column_heading_ids:
cols_widhts.append(float((float(_tbl_widths.replace('cm',''))/float(2.0))/len(que.column_heading_ids)))
else:
cols_widhts.append(float(_tbl_widths.replace('cm','')))
tmp = 0.0
sum = 0.0
i = 0
if que.comment_column:
for col in cols_widhts:
if i == 0:
cols_widhts[i] = cols_widhts[i]/2.0
tmp = cols_widhts[i]
sum += col
i += 1
cols_widhts.append(round(tmp,2))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = colWidths+'cm'
matrix_ans = ['',]
for col in que.column_heading_ids:
if col.title not in matrix_ans:
matrix_ans.append(col.title)
if que.comment_column:
matrix_ans.append(to_xml(tools.ustr(que.column_name)))
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl"><tr>"""
for mat_col in matrix_ans:
rml += """<td><para style="response">""" + to_xml(tools.ustr(mat_col)) + """</para></td>"""
rml += """</tr></blockTable>"""
i = 0
for ans in que.answer_choice_ids:
if i%2 != 0:
style='ans_tbl_white'
else:
style='ans_tbl_gainsboro'
i += 1
rml += """
<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'>
<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
rec_width = float((sum-tmp)*10+100)
value = ""
if que.type in ['matrix_of_drop_down_menus']:
value = """ <fill color="white"/>
<rect x="-0.1cm" y="-0.45cm" width='""" + tools.ustr(cols_widhts[-1] - 0.5) +"cm" + """' height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>"""
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
value = """ <fill color="white"/>
<circle x="0.35cm" y="-0.18cm" radius="0.25 cm" fill="yes" stroke="yes"/>"""
else:
value = """ <fill color="white"/>
<rect x="0.1cm" y="-0.4cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>"""
for mat_col in range(1,len(matrix_ans)):
if matrix_ans[mat_col] == que.column_name:
if mat_col == 1:
rml += """
<td><para style="answer_left">""" + to_xml(tools.ustr(que.column_name)) + """</para></td>"""
else:
rml += """<td></td>"""
else:
rml += """<td><illustration>""" + value + """</illustration></td>"""
rml += """</tr></blockTable>"""
elif que.type in ['multiple_textboxes', 'numerical_textboxes', 'date_and_time','date','multiple_textboxes_diff_type']:
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = tools.ustr(colWidths) + 'cm'
for ans in que.answer_choice_ids:
rml += """<para style="P1"></para>
<blockTable colWidths=" """+ colWidths + """ " style="ans_tbl">
<tr>
<td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
<td>
<illustration>
<rect x="0.0cm" y="-0.5cm" width='""" + tools.ustr(str(cols_widhts[0] - 0.3) + "cm") + """' height="0.6cm" fill="no" stroke="yes"/>
</illustration>
</td>
</tr>
</blockTable>"""
elif que.type in ['comment']:
cols_widhts.append(float(_tbl_widths.replace('cm','')))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
rml += """<blockTable colWidths=" """ + colWidths + """cm " style="ans_tbl">
<tr>
<td><para style="comment"><font color="white"> </font></para>
<illustration>
<rect x="0.1cm" y="0.3cm" width='""" + tools.ustr(str(float(colWidths) - 0.6) +'cm') + """' height="1.5cm" fill="no" stroke="yes"/>
</illustration>
</td>
</tr>
</blockTable>"""
elif que.type in ['single_textbox']:
cols_widhts.append(float(_tbl_widths.replace('cm','')))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
rml += """<para style="P2"><font color="white"> </font></para>
<blockTable colWidths=" """ + colWidths + """cm " style="ans_tbl">
<tr>
<td>
<illustration>
<rect x="0.2cm" y="0.3cm" width='""" + tools.ustr(str(float(colWidths) - 0.7) +'cm') + """' height="0.6cm" fill="no" stroke="yes"/>
</illustration>
</td>
</tr>
</blockTable>"""
elif que.type in ['table']:
tbl_width = float(_tbl_widths.replace('cm',''))
for i in range(0,len(que.column_heading_ids)):
cols_widhts.append(tbl_width/float(len(que.column_heading_ids)))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = colWidths+'cm'
rml += """<blockTable colWidths=" """ + colWidths + """ " style="tbl"><tr>"""
for col in que.column_heading_ids:
rml+="""<td><para style="terp_tblheader_Details">""" + to_xml(tools.ustr(col.title)) + """</para></td>"""
rml += """</tr></blockTable>"""
i = 0
for r in range(0,que.no_of_rows):
if i%2 != 0:
style = 'tbl_white'
else:
style = 'tbl_gainsboro'
i += 1
rml += """<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'><tr>"""
for c in que.column_heading_ids:
rml += """
<td><para style="terp_default_9"><font color="white"> </font></para></td>"""
rml += """</tr></blockTable>"""
if datas.has_key('form') and not datas['form']['without_pagebreak']:
rml += """<pageBreak/>"""
elif not datas.has_key('form'):
rml += """<pageBreak/>"""
else:
rml += """<para style="P2"><font></font></para>"""
rml += """</story></document>"""
report_type = datas.get('report_type', 'pdf')
create_doc = self.generators[report_type]
pdf = create_doc(rml, title=self.title)
return (pdf, report_type)
survey_form('report.survey.form', 'survey','','')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,24 +1,22 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_survey_type_manager,survey.type.manager,model_survey_type,base.group_tool_manager,1,1,1,1
access_survey_request_manager,survey.request manager,model_survey_request,base.group_tool_manager,1,1,1,1
access_survey_tbl_column_heading_manager,survey.tbl.column.heading manager,model_survey_tbl_column_heading,base.group_tool_manager,1,1,1,1
access_survey_res_partner_user,survey.res.partner.user,base.model_res_partner,base.group_tool_user,1,1,1,1
access_survey_user,survey.user,model_survey,base.group_tool_user,1,1,1,1
access_survey_page_user,survey.page user,model_survey_page,base.group_tool_user,1,1,1,1
access_survey_question_user,survey.question user,model_survey_question,base.group_tool_user,1,1,1,1
access_survey_answer_user,survey.answer user,model_survey_answer,base.group_tool_user,1,1,1,1
access_survey_response_user,survey.response user,model_survey_response,base.group_tool_user,1,1,1,1
access_survey_response_answer_user,survey.response.answer user,model_survey_response_answer,base.group_tool_user,1,1,1,1
access_survey_history_user,survey.history.user,model_survey_history,base.group_tool_user,1,1,1,1
access_survey_response_line_user,survey.response.line user,model_survey_response_line,base.group_tool_user,1,1,1,1
access_survey_res_partner_user,survey.res.partner.user,base.model_res_partner,base.group_tool_user,1,1,1,1
access_survey_survey_user,survey.survey.user,model_survey,base.group_survey_user,1,1,1,1
access_survey_page_survey_user,survey.page.survey.user,model_survey_page,base.group_survey_user,1,1,1,1
access_survey_question_survey_user,survey.question.survey.user,model_survey_question,base.group_survey_user,1,1,1,1
access_survey_answer_survey_user,survey.answer.survey.user,model_survey_answer,base.group_survey_user,1,1,1,1
access_survey_response_survey_user,survey.response.survey.user,model_survey_response,base.group_survey_user,1,1,1,1
access_survey_response_answer_survey_user,survey.response.answer.survey.user,model_survey_response_answer,base.group_survey_user,1,1,1,1
access_survey_history_survey_user,survey.history.survey.user,model_survey_history,base.group_survey_user,1,1,1,1
access_survey_response_line_survey_user,survey.response.line.survey.user,model_survey_response_line,base.group_survey_user,1,1,1,1
access_survey_question_column_heading_survey_user,survey.question.column.heading.survey.user,model_survey_question_column_heading,base.group_survey_user,1,0,0,0
access_survey_question_column_heading_user,survey.question.column.heading user,model_survey_question_column_heading,base.group_tool_user,1,1,1,1
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_survey_public,survey.survey public,model_survey_survey,base.group_public,1,0,0,0
access_survey_page_public,survey.page public,model_survey_page,base.group_public,1,0,0,0
access_survey_question_public,survey.question public,model_survey_question,base.group_public,1,0,0,0
access_survey_label_public,survey.label public,model_survey_label,base.group_public,1,0,0,0
access_survey_user_input_public,survey.user_input public,model_survey_user_input,base.group_public,1,1,1,0
access_survey_user_input_line_public,survey.user_input_line public,model_survey_user_input_line,base.group_public,1,1,1,0
access_survey_stage_public,survey.stage public,model_survey_stage,base.group_public,1,0,0,0
access_survey_user,survey.survey user,model_survey_survey,base.group_survey_user,1,0,0,0
access_survey_page_user,survey.page user,model_survey_page,base.group_survey_user,1,0,0,0
access_survey_question_user,survey.question user,model_survey_question,base.group_survey_user,1,0,0,0
access_survey_label_user,survey.label user,model_survey_label,base.group_survey_user,1,0,0,0
access_survey_user_input_user,survey.user_input user,model_survey_user_input,base.group_survey_user,1,1,1,0
access_survey_user_input_line_user,survey.user_input_line user,model_survey_user_input_line,base.group_survey_user,1,1,1,0
access_survey_stage_user,survey.stage user,model_survey_stage,base.group_survey_user,1,0,0,0
access_survey_manager,survey.survey manager,model_survey_survey,base.group_survey_manager,1,1,1,1
access_survey_page_manager,survey.page manager,model_survey_page,base.group_survey_manager,1,1,1,1
access_survey_question_manager,survey.question manager,model_survey_question,base.group_survey_manager,1,1,1,1
access_survey_label_manager,survey.label manager,model_survey_label,base.group_survey_manager,1,1,1,1
access_survey_user_input_manager,survey.user_input manager,model_survey_user_input,base.group_survey_manager,1,1,1,1
access_survey_user_input_line_manager,survey.user_input_line manager,model_survey_user_input_line,base.group_survey_manager,1,1,1,1
access_survey_stage_manager,survey.stage manager,model_survey_stage,base.group_survey_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_survey_type_manager access_survey_public survey.type.manager survey.survey public model_survey_type model_survey_survey base.group_tool_manager base.group_public 1 1 0 1 0 1 0
3 access_survey_request_manager access_survey_page_public survey.request manager survey.page public model_survey_request model_survey_page base.group_tool_manager base.group_public 1 1 0 1 0 1 0
4 access_survey_tbl_column_heading_manager access_survey_question_public survey.tbl.column.heading manager survey.question public model_survey_tbl_column_heading model_survey_question base.group_tool_manager base.group_public 1 1 0 1 0 1 0
5 access_survey_res_partner_user access_survey_label_public survey.res.partner.user survey.label public base.model_res_partner model_survey_label base.group_tool_user base.group_public 1 1 0 1 0 1 0
6 access_survey_user access_survey_user_input_public survey.user survey.user_input public model_survey model_survey_user_input base.group_tool_user base.group_public 1 1 1 1 0
7 access_survey_page_user access_survey_user_input_line_public survey.page user survey.user_input_line public model_survey_page model_survey_user_input_line base.group_tool_user base.group_public 1 1 1 1 0
8 access_survey_question_user access_survey_stage_public survey.question user survey.stage public model_survey_question model_survey_stage base.group_tool_user base.group_public 1 1 0 1 0 1 0
9 access_survey_answer_user access_survey_user survey.answer user survey.survey user model_survey_answer model_survey_survey base.group_tool_user base.group_survey_user 1 1 0 1 0 1 0
10 access_survey_response_user access_survey_page_user survey.response user survey.page user model_survey_response model_survey_page base.group_tool_user base.group_survey_user 1 1 0 1 0 1 0
11 access_survey_response_answer_user access_survey_question_user survey.response.answer user survey.question user model_survey_response_answer model_survey_question base.group_tool_user base.group_survey_user 1 1 0 1 0 1 0
12 access_survey_history_user access_survey_label_user survey.history.user survey.label user model_survey_history model_survey_label base.group_tool_user base.group_survey_user 1 1 0 1 0 1 0
13 access_survey_response_line_user access_survey_user_input_user survey.response.line user survey.user_input user model_survey_response_line model_survey_user_input base.group_tool_user base.group_survey_user 1 1 1 1 0
14 access_survey_res_partner_user access_survey_user_input_line_user survey.res.partner.user survey.user_input_line user base.model_res_partner model_survey_user_input_line base.group_tool_user base.group_survey_user 1 1 1 1 0
15 access_survey_survey_user access_survey_stage_user survey.survey.user survey.stage user model_survey model_survey_stage base.group_survey_user 1 1 0 1 0 1 0
16 access_survey_page_survey_user access_survey_manager survey.page.survey.user survey.survey manager model_survey_page model_survey_survey base.group_survey_user base.group_survey_manager 1 1 1 1
17 access_survey_question_survey_user access_survey_page_manager survey.question.survey.user survey.page manager model_survey_question model_survey_page base.group_survey_user base.group_survey_manager 1 1 1 1
18 access_survey_answer_survey_user access_survey_question_manager survey.answer.survey.user survey.question manager model_survey_answer model_survey_question base.group_survey_user base.group_survey_manager 1 1 1 1
19 access_survey_response_survey_user access_survey_label_manager survey.response.survey.user survey.label manager model_survey_response model_survey_label base.group_survey_user base.group_survey_manager 1 1 1 1
20 access_survey_response_answer_survey_user access_survey_user_input_manager survey.response.answer.survey.user survey.user_input manager model_survey_response_answer model_survey_user_input base.group_survey_user base.group_survey_manager 1 1 1 1
21 access_survey_history_survey_user access_survey_user_input_line_manager survey.history.survey.user survey.user_input_line manager model_survey_history model_survey_user_input_line base.group_survey_user base.group_survey_manager 1 1 1 1
22 access_survey_response_line_survey_user access_survey_stage_manager survey.response.line.survey.user survey.stage manager model_survey_response_line model_survey_stage base.group_survey_user base.group_survey_manager 1 1 1 1
access_survey_question_column_heading_survey_user survey.question.column.heading.survey.user model_survey_question_column_heading base.group_survey_user 1 0 0 0
access_survey_question_column_heading_user survey.question.column.heading user model_survey_question_column_heading base.group_tool_user 1 1 1 1

View File

@ -1,19 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record model="res.groups" id="base.group_tool_user">
<field name="name">User</field>
<field name="category_id" ref="base.module_category_tools"/>
</record>
<record model="res.groups" id="base.group_tool_manager">
<field name="name">Manager</field>
<field name="category_id" ref="base.module_category_tools"/>
<field name="implied_ids" eval="[(4, ref('base.group_tool_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<data>
<!-- Survey users -->
<record model="res.groups" id="base.group_survey_user">
<field name="name">Survey / User</field>
</record>
<!-- Survey managers -->
<record model="res.groups" id="base.group_survey_manager">
<field name="name">Survey / Manager</field>
<field name="implied_ids" eval="[(4, ref('base.group_survey_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<!-- Record rules -->
<record id="survey_public_access" model="ir.rule">
<field name="name">Public access to surveys</field>
<field name="model_id" ref="survey.model_survey_survey"/>
<field name="domain_force">[('state', '=', 'open'), ('auth_required', '=', False)]</field>
<field name="groups" eval="[(4, ref('base.group_public'))]"/>
<field eval="0" name="perm_unlink"/>
<field eval="0" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="0" name="perm_create"/>
</record>
<record id="survey_rule" model="ir.rule">
<field name="name">Access to survey for regular users</field>
<field name="model_id" ref="survey.model_survey_survey"/>
<field name="domain_force">[('stage_id.closed', '=', False)]</field>
<field name="groups" eval="[(4, ref('base.group_survey_user'))]"/>
<field eval="0" name="perm_unlink"/>
<field eval="0" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="0" name="perm_create"/>
</record>
<record id="survey_rule_manager" model="ir.rule">
<field name="name">Survey Manager access rights</field>
<field name="model_id" ref="survey.model_survey_survey"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('base.group_survey_manager'))]"/>
<field eval="1" name="perm_unlink"/>
<field eval="1" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="1" name="perm_create"/>
</record>
<record id="survey_public_access" model="ir.rule">
<field name="name">Public access to user_input</field>
<field name="model_id" ref="survey.model_survey_user_input"/>
<field name="domain_force">[('create_uid', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('base.group_public'))]"/>
<field eval="0" name="perm_unlink"/>
<field eval="1" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="1" name="perm_create"/>
</record>
<record id="survey_rule" model="ir.rule">
<field name="name">Access to user_input for regular users</field>
<field name="model_id" ref="survey.model_survey_user_input"/>
<field name="domain_force">[('create_uid', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('base.group_survey_user'))]"/>
<field eval="0" name="perm_unlink"/>
<field eval="1" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="1" name="perm_create"/>
</record>
<record id="survey_rule_manager" model="ir.rule">
<field name="name">Survey Manager access rights</field>
<field name="model_id" ref="survey.model_survey_user_input"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('base.group_survey_manager'))]"/>
<field eval="1" name="perm_unlink"/>
<field eval="1" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="1" name="perm_create"/>
</record>
</data>
</openerp>

View File

@ -1,157 +0,0 @@
Date : 8th October, 2009
Created by : Harshad Modi(hmo) and Yogesh(ysa)
--------------------------------------------------------------------------------------
**** Specification of Survay module in OpenERP ****
Basic Requirements :
======================================================================================
> Design own survey form
> Desing own Questionaries
> Collect Response
> Analyze Result
Design own survey form:
---------------------------------------------------------------
Allow to make multiple own survey pages with multiple questions with different question type.
Note : After finish first Phase of Development, Allow to design page template to specify customize theme for bgcolor, bgimage, font style, font color
Design Questinaries :
-------------------------------------------------------
Questinaries should has :
* can specify question text
* can make Answer sheet
Question Type:
* Survey Admin can able to design answer option like:
- Mutiple Choice with one answer
- Mutilpe Choice with multiple answer
Collect Response :
---------------------------------------------------------
Survey Admin can able to :
- Create a link
- Send a survey invitation to others peple by mail
- Allow to set max limit of Response
- Survey Admin can able to close survey
Analyze Result :
----------------------------------------------------------
- Show Result with all Survey pages with total responses, responce count and calculate avarage response.
OpenERP model Design :
====================================================================
survey :
-------------------------------------------
title - char(128)
pages_ids - one2many(survey_page)
date_open
date_close
survey_link
max_response_limit
status (draft, open, close, cancel)
resposible - many2one (res.user)
survey_page:
-------------------------------------------------------------------
title - char(128)
page_template_id - many2one( survey_page_template)
survey_id - many2one(survey)
question_ids - one2many(survey_question)
sequence - int
note - char(256)
survey_question:
--------------------------------------------------------------
page_id - many2one(survey_page)
question - char(128)
answer_choice_ids - one2many(survey_answer)
response_ids - one2many(survey_response)
is_require_answer
allow_comment
sequence - int
survey_answer:
--------------------------------------------------------------------------
question_id - many2one(survey_question)
answer - char(128)
sequence - int
survey_response:
--------------------------------------------------------------------
date_create
date_modify
status (done, skip)
response_by - many2one(res.users)
question_id - many2one(survey_question)
response_type ( from manual, link, mail)
response_answer_ids - one2many(survey_response_answer)
survey_response_answer:
--------------------------------------------------------------------
response_id - many2one(survey_response)
question_id - many2one(survey_answer)
comment
OpenERP View Design:
==================================================
Survey View :
see survey.png file
Survey Pages View:
see survey_page.png file
Survey Question View:
see survey_qyestion.png file
Survey Response View :
see survey_response.png file
OpenERP Report Design :
===================================================
Design postgres view to display statistical information of response per question, response per user, etc..
More detail will be provided later.
OpenERP Menu Design :
=====================================================
Survey Management :
> Surveys
> All Surveys
> New Survey
> Survey Pages
> All Survey Pages
> New Survey Page
> Survey Response
> All Survey Responses
> New Survey Response
> Reports
> Response per Survey
> Response per Survey Page
> Response per Question
> Response per User
References :
===============================================
http://www.surveymonkey.com/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View File

@ -1,13 +0,0 @@
.openerp .oe_survey_title {
font-weight: bold;
font-size: 19px;
margin: 8px 0px 8px 0px;
color: #5B5B5B;
}
.openerp .oe_kanban_survey {
/* Customize height and width according bootstrap3 */
width: 212px;
min-height: 86px !important;
/* End of customize */
}

View File

@ -0,0 +1,53 @@
.only_right_radius {
border-top-right-radius: 2em;
border-bottom-right-radius: 2em;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.only_left_radius {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 2em;
border-bottom-left-radius: 2em;
}
.no_radius {
border-radius: 0;
}
.clear_survey_filter, .filter-all, .filter-finished{
cursor: pointer;
}
.nvtooltip h5 {
margin: 0;
line-height: 18px;
font-weight: bold;
background-color: rgba(247,247,247,0.75);
text-align: center;
border-bottom: 1px solid #ebebeb;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.survey_answer i {
padding:3px;
cursor:pointer;
}
.survey_answer i.invisible {
visibility: hidden!important;
}
@media print {
.tab-content > .tab-pane {
display: block;
}
.tab-content > .survey_graph > svg {
width: 1150px;
}
}

View File

@ -0,0 +1,131 @@
/*
* OpenERP, Open Source Management Solution
* Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This file is intended to add interactivity to survey forms rendered by
* the website engine.
*/
$(document).ready(function () {
'use strict';
console.debug("[survey] Custom JS for survey is loading...");
var the_form = $('.js_surveyform');
var prefill_controller = the_form.attr("data-prefill");
var validate_controller = the_form.attr("data-validate");
var submit_controller = the_form.attr("data-submit");
var print_mode = false;
// Printing mode: will disable all the controls in the form
if (_.isUndefined(submit_controller)) {
$('.js_surveyform :input').prop('disabled', true);
print_mode = true;
}
// Custom code for right behavior of radio buttons with comments box
$('.js_comments>input[type="text"]').focusin(function(){
$(this).prev().find('>input').attr("checked","checked");
});
$('.js_radio input[type="radio"][data-oe-survey-otherr!="1"]').click(function(){
$(this).closest('.js_radio').find('.js_comments>input[type="text"]').val("");
});
$('.js_comments input[type="radio"]').click(function(){
$(this).closest('.js_comments').find('>input[data-oe-survey-othert="1"]').focus();
});
// Custom code for right behavior of dropdown menu with comments
$('.js_drop input[data-oe-survey-othert="1"]').hide();
$('.js_drop select').change(function(){
var other_val = $(this).find('.js_other_option').val();
if($(this).val() === other_val){
$(this).parent().removeClass('col-md-12').addClass('col-md-6');
$(this).closest('.js_drop').find('input[data-oe-survey-othert="1"]').show().focus();
}
else{
$(this).parent().removeClass('col-md-6').addClass('col-md-12');
$(this).closest('.js_drop').find('input[data-oe-survey-othert="1"]').val("").hide();
}
});
// Custom code for right behavior of checkboxes with comments box
$('.js_ck_comments>input[type="text"]').focusin(function(){
$(this).prev().find('>input').attr("checked","checked");
});
$('.js_ck_comments input[type="checkbox"]').change(function(){
if (! $(this).prop("checked")){
$(this).closest('.js_ck_comments').find('input[type="text"]').val("");
}
});
// Pre-filling of the form with previous answers
function prefill(){
var prefill_def = $.ajax(prefill_controller, {dataType: "json"})
.done(function(json_data){
_.each(json_data, function(value, key){
the_form.find(".form-control[name=" + key + "]").val(value);
the_form.find("input[name^=" + key + "]").each(function(){
$(this).val(value);
});
});
})
.fail(function(){
console.warn("[survey] Unable to load prefill data");
});
return prefill_def;
}
// Parameters for form submission
$('.js_surveyform').ajaxForm({
url: submit_controller,
type: 'POST', // submission type
dataType: 'json', // answer expected type
beforeSubmit: function(){ // hide previous errmsg before resubmitting
$('.js_errzone').html("").hide();
},
success: function(response, status, xhr, wfe){ // submission attempt
if(_.has(response, 'errors')){ // some questions have errors
_.each(_.keys(response.errors), function(key){
$("#" + key + '>.js_errzone').append('<p>' + response.errors[key] + '</p>').show();
});
return false;
}
else if (_.has(response, 'redirect')){ // form is ok
window.location.replace(response.redirect);
return true;
}
else { // server sends bad data
console.error("Incorrect answer sent by server");
return false;
}
},
timeout: 5000,
error: function(jqXHR, textStatus, errorThrown){ // failure of AJAX request
$('#AJAXErrorModal').modal('show');
}
});
// // Handles the event when a question is focused out
// $('.js_question-wrapper').focusout(
// function(){
// console.debug("[survey] Focus lost on question " + $(this).attr("id"));
// });
// Launch prefilling
prefill();
console.debug("[survey] Custom JS for survey loaded!");
});

View File

@ -0,0 +1,177 @@
/*
* OpenERP, Open Source Management Solution
* Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$(document).ready(function () {
'use strict';
console.debug("[survey] Survey Result JS is loading...");
//Script For Pagination
var survey_pagination = $('.pagination');
$.each(survey_pagination, function(index, pagination){
var question_id = $(pagination).attr("data-question_id");
var limit = $(pagination).attr("data-record_limit"); //Number of Record Par Page. If you want to change number of record per page, change record_limit in pagination template.
$('#table_question_'+ question_id +' tbody tr:lt('+limit+')').removeClass('hidden');
$('#pagination_'+question_id+' li:first').addClass('active');
$('#pagination_'+question_id+' li a').click(function(event){
event.preventDefault();
$('#pagination_'+question_id+' li').removeClass('active');
$(this).parent('li').addClass('active');
$('#table_question_'+ question_id +' tbody tr').addClass('hidden');
var num = $(this).text();
var min = (limit * (num-1))-1;
if (min == -1){
$('#table_question_'+ question_id +' tbody tr:lt('+ limit * num +')').removeClass('hidden');
}
else{
$('#table_question_'+question_id+' tbody tr:lt('+ limit * num +'):gt('+min+')').removeClass('hidden');
}
});
});
//initialize MultiBar Chart
function init_multibar_chart(){
var chart = nv.models.multiBarChart()
.x(function(d) { return d.text; })
.y(function(d) { return d.count; })
.staggerLabels(true);
// Replacing Library's Default Tooltip with our Custom One
chart.tooltip(function(key, x, y, e, graph) {
return '<h5 class="panel-primary"><div class="panel-heading">' + x + '</div></h5>' +
'<p>' + '<b>Responses : </b>' + key + '</p>' +
'<p>' + "<b>Total Vote : </b>" + y + '</p>';
});
return chart;
}
//initialize discreteBar Chart
function init_bar_chart(){
return nv.models.discreteBarChart()
.x(function(d) { return d.text; })
.y(function(d) { return d.count; })
.staggerLabels(true)
.tooltips(false)
.showValues(true);
}
//initialize Pie Chart
function init_pie_chart(){
return nv.models.pieChart()
.x(function(d) { return d.text; })
.y(function(d) { return d.count; })
.showLabels(false);
}
//load chart to svg element chart:initialized chart, response:AJAX response, quistion_id:if of survey question, tick_limit:text length limit
function load_chart(chart, response, question_id, tick_limit, graph_type){
// Custom Tick fuction for replacing long text with '...'
var customtick_function = function(d){
if(! this || d.length <= tick_limit){
return d;
}
else{
return d.slice(0,tick_limit) + '...';
}
};
if (graph_type != 'pie'){
chart.xAxis
.tickFormat(customtick_function);
chart.yAxis
.tickFormat(d3.format('d'));
}
d3.select('#graph_question_' + question_id + ' svg')
.datum(response)
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
}
//Script For Graph
var survey_graphs = $('.survey_graph');
$.each(survey_graphs, function(index, graph){
var question_id = $(graph).attr("data-question_id");
var graph_type = $(graph).attr("data-graph_type");
var graph_data = JSON.parse($(graph).attr("graph-data"));
if(graph_type == 'multi_bar'){
nv.addGraph(function(){
var chart = init_multibar_chart();
return load_chart(chart, graph_data, question_id, 25);
});
}
else if(graph_type == 'bar'){
nv.addGraph(function() {
var chart = init_bar_chart();
return load_chart(chart, graph_data, question_id, 35);
});
}
else if(graph_type == 'pie'){
nv.addGraph(function() {
var chart = init_pie_chart();
return load_chart(chart, graph_data, question_id, 25, 'pie');
});
}
});
// Script for filter
$('td.survey_answer').hover(function(){
$(this).find('i.fa-filter').removeClass('invisible');
}, function(){
$(this).find('i.fa-filter').addClass('invisible');
});
$('td.survey_answer i.fa-filter').click(function(){
var cell = $(this);
var row_id = cell.attr('data-row_id') | 0;
var answer_id = cell.attr('data-answer_id');
if(document.URL.indexOf("?") == -1){
window.location.href = document.URL + '?' + encodeURI(row_id + ',' + answer_id);
}
else {
window.location.href = document.URL + '&' + encodeURI(row_id + ',' + answer_id);
}
});
// for clear all filters
$('.clear_survey_filter').click(function(){
window.location.href = document.URL.substring(0,document.URL.indexOf("?"));
});
$('span.filter-all').click(function(){
event.preventDefault();
if(document.URL.indexOf("finished") != -1){
window.location.href = document.URL.replace('?finished&','?').replace('&finished&','&').replace('?finished','').replace('&finished','');
}
}).hover(function(){
if(document.URL.indexOf("finished") == -1){
$(this)[0].style.cursor = 'default';
}
});
// toggle finished/all surveys filter
$('span.filter-finished').click(function(){
event.preventDefault();
if(document.URL.indexOf("?") == -1){
window.location.href = document.URL + '?' + encodeURI('finished');
}
else if(document.URL.indexOf("finished") == -1){
window.location.href = document.URL + '&' + encodeURI('finished');
}
}).hover(function(){
if(document.URL.indexOf("finished") != -1){
$(this)[0].style.cursor = 'default';
}
});
console.debug("[survey] Survey Result JS loaded!");
});

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="survey.type" id="survey_type1">
<field name="name">Human Resources</field>
<field name="code">Human Resources</field>
</record>
<record model="survey.type" id="survey_type2">
<field name="name">Customer Feeback</field>
<field name="code">Customer Feeback</field>
</record>
<record model="survey.type" id="survey_type3">
<field name="name">Supplier Selection</field>
<field name="code">Supplier Selection</field>
</record>
</data>
</openerp>

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<report auto="False"
id="report_survey_form"
model="survey"
name="survey.form"
string="Survey"/>
<report auto="True"
id="survey_analysis"
model="survey"
name="survey.analysis"
rml=""
string="Survey Statistics"/>
<report auto="True"
id="survey_browse_response"
model="survey"
name="survey.browse.response"
rml=""
string="Survey Answers"/>
</data>
</openerp>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import test_survey
checks = [
test_survey
]

View File

@ -1,50 +0,0 @@
-
In order to check Survey Request of the survey "Initial Partner Feedback" I create a Survey Request for survey "Initial Partner Feedback".
-
!record {model: survey.request, id: survey_request_1}:
survey_id: survey_Initial_partner_feedback
user_id: base.user_demo
-
!assert {model: survey.request, id: survey_request_1, string: Survey Request should be in draft state}:
- state == 'draft'
-
I set Survey Request for the survey in waiting state.
-
!python {model: survey.request}: |
self.survey_req_waiting_answer(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey Request for the survey is waiting or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in waiting state}:
- state == 'waiting_answer'
-
I cancel the Survey Request of the survey.
-
!python {model: survey.request}: |
self.survey_req_cancel(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey Request of the survey is cancel or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in cancel state}:
- state == 'cancel'
-
I set Survey Request of the survey in draft state.
-
!python {model: survey.request}: |
self.survey_req_draft(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey request of the survey is draft or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in draft state}:
- state == 'draft'
-
I set survey request of the survey in done state.
-
!python {model: survey.request}: |
self.survey_req_waiting_answer(cr, uid, [ref("survey_request_1")], context)
self.survey_req_done(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey request of the survey is done or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in done state}:
- state == 'done'

View File

@ -1,111 +0,0 @@
-
In order to check the survey module in OpenERP I use the survey "Initial Partner Feedback".
-
I set the survey in Open state.
-
!python {model: survey}: |
sur = self.survey_open(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
I check state of survey is open or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in open state}:
- state == 'open'
-
I check that the survey is reopened or not.
-
!python {model: survey}: |
self.survey_cancel(cr, uid, [ref('survey_Initial_partner_feedback')],context)
self.survey_open(cr, uid, [ref('survey_Initial_partner_feedback')],context)
-
I check that state of survey is open or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in open state}:
- state == 'open'
-
I set the state of the survey open.
-
!python {model: survey}: |
sur = self.survey_open(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
In order to print the survey I click on Print.
-
!python {model: survey.print}: |
id = self.create(cr, uid, {'survey_ids': [(6,0,[ref('survey.survey_Initial_partner_feedback')])]})
self.action_next(cr, uid, [id], context)
-
In order to answer the survey I click on "Answer a Survey" wizard.
-
!python {model: survey.name.wiz}: |
id = self.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")})
self.action_next(cr, uid, [id], context)
-
I give the answer of the first and second page of the survey.
-
!python {model: survey.question.wiz}: |
ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')]}
self.fields_view_get(cr, uid, ref("survey.view_survey_question_message"),"form", context=ctx)
values = self.default_get(cr, uid, ['name'], ctx)
id = self.create(cr, uid, {str(ref("survey_initial_question_company_name")) +"_single" :'Tiny' , str(ref("survey_initial_question_company_size")) + "_selection" : int(ref("survey.survey_initial_question_company_size_51")), }, context)
self.action_next(cr, uid, [id], context)
id = self.create(cr, uid, {str(ref("survey_initial_question_contract_customers")) + "_selection" : int(ref("survey_initial_answer_sometimes")), str(ref("survey_initial_question_sell_to_your_customers")) + "_selection" : int(ref("survey_initial_answer_maintenance_contract")), }, context)
self.action_next(cr, uid, [id], context)
-
I print the answers of the survey.
-
!python {model: survey.browse.answer}: |
id = self.create(cr, uid, {'survey_id': ref('survey.survey_Initial_partner_feedback')})
self.action_next(cr, uid, [id], context)
-
I edit questions of the survey as per requirement.
-
!python {model: survey.question.wiz}: |
name_wiz_obj = self.pool.get('survey.name.wiz')
id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")})
ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')], 'question_id': ref('survey_initial_question_company_name'), 'page_number': -1,'sur_name_id': id}
self.action_edit_question(cr, uid, [ref('survey_initial_question_company_name')], context = ctx)
self.action_delete_question(cr, uid, [ref('survey_initial_question_company_name')], context = ctx)
self.action_new_question(cr, uid, [], context = ctx)
-
I edit Page of the survey as per requirement.
-
!python {model: survey.question.wiz}: |
name_wiz_obj = self.pool.get('survey.name.wiz')
id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")})
ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')], 'page_id': ref('survey_initial_page_Contracts'), 'sur_name_id': id}
self.action_edit_page(cr, uid, [ref('survey_initial_page_Contracts')], context = ctx)
self.action_delete_page(cr, uid, [ref('survey_initial_page_Contracts')], context = ctx)
self.action_new_page(cr, uid, [], context = ctx)
-
In order to send invitation to the users I click on "Send Invitation" wizard.
-
!python {model: survey.send.invitation}: |
context = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')]}
values = self.default_get(cr, uid, ['mail_from', 'mail_subject', 'send_mail_existing', 'mail_subject_existing', 'mail', 'partner_ids', 'send_mail'], context)
values['mail_from'] = 'Surveyor'
new_id = self.create(cr, uid, values)
self.action_send(cr, uid, [new_id], context)
-
I set the value in "Total start survey" field.
-
!record {model: survey, id: survey_Initial_partner_feedback}:
tot_start_survey: 1
-
I set the survey in Cancel state.
-
!python {model: survey}: |
self.survey_cancel(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
I check state of survey is cancel or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in cancel state}:
- state == 'cancel'
-
I set the survey in close state.
-
!python {model: survey}: |
self.survey_close(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
I check state of Survey is close or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in close state}:
- state == 'close'

View File

@ -1,6 +0,0 @@
-
I check the question type of the survey "Initial Partner Feedback".
-
!python {model: survey.question}: |
sur_question = self.on_change_type(cr, uid, [ref("survey_Initial_partner_feedback")], 'multiple_textboxes_diff_type')
assert sur_question

View File

@ -1,26 +0,0 @@
-
I print the Survey Browse Response Report through the wizard.
-
!python {model: survey}: |
ctx = {'model': 'survey','active_ids': [(6,0,[ref('survey_partner_feedback')])]}
data_dict = {'response_ids' : [(6,0,[ref('survey.survey_partner_feedback')])], 'page_number' : True, 'without_pagebreak': True}
from openerp.tools import test_reports
test_reports.try_report_action(cr, uid, 'action_view_survey_print_answer',wiz_data=data_dict, context=ctx, our_module='survey')
-
I print the Survey Analysis Report through the wizard.
-
!python {model: survey}: |
ctx = {'model': 'survey','active_ids': [(6,0,[ref('survey_partner_feedback')])]}
data_dict = {'survey_ids' : [(6,0,[ref('survey.survey_partner_feedback')])]}
from openerp.tools import test_reports
test_reports.try_report_action(cr, uid, 'action_view_survey_print_statistics',wiz_data=data_dict, context=ctx, our_module='survey')
-
I print the Survey Form Report through the wizard.
-
!python {model: survey}: |
ctx = {'model': 'survey','active_ids': [(6,0,[ref('survey_partner_feedback')])]}
data_dict = {'survey_ids' : [(6,0,[ref('survey.survey_partner_feedback')])], 'page_number' : True, 'without_pagebreak': True}
from openerp.tools import test_reports
test_reports.try_report_action(cr, uid, 'action_view_survey_print',wiz_data=data_dict, context=ctx, our_module='survey')

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2014-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.tests import common
class test_survey(common.TransactionCase):
def setUp(self):
super(test_survey, self).setUp()
cr, uid, context = self.cr, self.uid, {}
pass
def test_00_create_survey_and_questions(self):
cr, uid, context = self.cr, self.uid, {}
pass
def test_01_fill_survey(self):
pass
def test_02_answer_survey(self):
pass

View File

@ -0,0 +1,316 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="result" name="Survey Result">
<t t-call="website.layout">
<t t-set="head">
<link href="/web_graph/static/src/css/nv.d3.css" rel="stylesheet" type="text/css"></link>
<link href="/survey/static/src/css/survey_result.css" rel="stylesheet" type="text/css"></link>
<script src="/web_graph/static/lib/nvd3/d3.v3.js"></script>
<script src="/web_graph/static/lib/nvd3/nv.d3.js"></script>
<script type="text/javascript" src="/survey/static/src/js/survey_result.js" />
</t>
<div class="oe_structure" />
<div class="container">
<div class="jumbotron mt32">
<t t-set="survey" t-value="survey_dict['survey']"/>
<h1><span t-field="survey.title"></span> <span style="font-size:1.5em;" class="fa fa-bar-chart-o pull-right "/></h1>
<h2><span t-field="survey.description"></span></h2>
</div>
<div class="panel panel-default hidden-print">
<div class="panel-heading"><span class="fa fa-filter"></span> Filters <span t-if="filter_display_data" class="pull-right text-primary clear_survey_filter"><i class="fa fa-times"></i> Clear All Filters</span></div>
<div class="panel-body">
<span t-if="filter_finish == True">
<span class="label label-default only_left_radius filter-all">All surveys</span><span class="label label-primary only_right_radius filter-finished">Finished surveys</span>
</span>
<span t-if="filter_finish == False">
<span class="label label-primary only_left_radius filter-all">All surveys</span><span class="label label-default only_right_radius filter-finished">Finished surveys</span>
</span>
<span t-foreach="filter_display_data" t-as="filter_data">
<span class="label label-primary only_left_radius"><i class="fa fa-filter"></i></span><span class="label label-primary no_radius" t-esc="filter_data['question_text']"></span><span class="label label-success only_right_radius" t-esc="' > '.join(filter_data['labels'])"></span>
</span>
</div>
</div>
<div t-foreach="survey_dict['page_ids']" t-as='page_ids'>
<t t-set="page" t-value="page_ids['page']"/>
<h1 class="mt16" t-field='page.title'></h1>
<hr/>
<div t-foreach="page_ids['question_ids']" t-as='question_ids' class="mt16">
<t t-set="input_summary" t-value="question_ids['input_summary']"/>
<t t-set="question" t-value="question_ids['question']"/>
<t t-set="graph_data" t-value="question_ids['graph_data']"/>
<t t-set="prepare_result" t-value="question_ids['prepare_result']"/>
<h4>
<b>Question </b>
<span t-field='question.question'></span>
<t t-if="question.type == 'matrix'">
<small><span class="label label-default">Matrix: <span t-field='question.matrix_subtype'/></span></small>
</t>
<t t-if="question.type in ['simple_choice', 'multiple_choice']">
<small><span t-field='question.type' class="label label-default"></span></small>
</t>
<span class="pull-right">
<span class="label label-success"><span t-esc="input_summary['answered']"></span> Answered</span>
<span class="label label-danger"><span t-esc="input_summary['skipped']"></span> Skipped</span>
</span>
</h4>
<t t-if="input_summary['answered'] != 0">
<t t-if="question.description">
<h5><span class="text-muted" t-field="question.description"></span></h5>
</t>
<t t-if="question.type in ['textbox', 'free_text', 'datetime']">
<t t-call="survey.result_text"></t>
</t>
<t t-if="question.type in ['simple_choice', 'multiple_choice']">
<t t-call="survey.result_choice"></t>
</t>
<t t-if="question.type == 'matrix'">
<t t-call="survey.result_matrix"></t>
</t>
<t t-if="question.type == 'numerical_box'">
<t t-call="survey.result_number"></t>
</t>
</t>
<t t-if="input_summary['answered'] == 0">
<h2 style="padding-top:30px;padding-bottom:30px;text-align:center;" class="text-muted">Sorry, No one answered this question.</h2>
</t>
</div>
</div>
</div>
<div class="oe_structure" />
</t>
</template>
<!-- Result for free_text,textbox and datetime -->
<template id="result_text" name="Text Result">
<table class="table table-hover table-condensed" t-att-id="'table_question_%d' % question.id">
<thead>
<tr>
<th>#</th>
<th>User Responses</th>
</tr>
</thead>
<tbody>
<t t-set="text_result" t-value="prepare_result"/>
<tr t-foreach="text_result" t-as="user_input">
<td><a t-att-href="'%s/%s' % (user_input.user_input_id.print_url, user_input.user_input_id.token)"><t t-esc="user_input_index + 1"></t></a></td>
<t t-if="question.type == 'free_text'">
<td>
<span t-field="user_input.value_free_text"></span><br/>
</td>
</t>
<t t-if="question.type == 'textbox'">
<td>
<span t-field="user_input.value_text"></span><br/>
</td>
</t>
<t t-if="question.type == 'datetime'">
<td>
<span class="oe_date" t-field="user_input.value_date"></span><br/>
</td>
</t>
</tr>
</tbody>
</table>
<t t-call="survey.pagination" />
</template>
<!-- Result for simple_choice and multiple_choice -->
<template id="result_choice" name="Choice Result">
<div>
<!-- Tabs -->
<ul class="nav nav-tabs hidden-print">
<li class="active" t-if="question.type != 'simple_choice'">
<a t-att-href="'#graph_question_%d' % question.id" data-toggle="tab">
<i class="fa fa-bar-chart-o"></i> Graph
</a>
</li>
<li class="active" t-if="question.type == 'simple_choice'">
<a t-att-href="'#graph_question_%d' % question.id" data-toggle="tab">
<i class="fa fa-bar-chart-o"></i> Pie Chart
</a>
</li>
<li>
<a t-att-href="'#data_question_%d' % question.id" data-toggle="tab">
<i class="fa fa-list-alt"></i> Data
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active survey_graph" t-if="question.type != 'simple_choice'" t-att-id="'graph_question_%d' % question.id" t-att-data-question_id="question.id" data-graph_type="bar" t-att-graph-data="graph_data">
<!-- svg element for drawing bar chart -->
<svg style="height:20em"></svg>
</div>
<div class="tab-pane active survey_graph" t-if="question.type == 'simple_choice'" t-att-id="'graph_question_%d' % question.id" t-att-data-question_id="question.id" data-graph_type="pie" t-att-graph-data="graph_data">
<!-- svg element for drawing pie chart -->
<svg style="height:20em"></svg>
</div>
<div class="tab-pane" t-att-id="'data_question_%d' % question.id">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>Answer Choices</th>
<th>User Responses</th>
</tr>
</thead>
<tbody>
<tr t-foreach="prepare_result" t-as="user_input">
<td>
<p t-esc="user_input['text']"></p>
</td>
<td class="survey_answer">
<span t-esc="round(user_input['count']*100.0/(input_summary['answered'] or 1),2)"></span> %
<span t-esc="user_input['count']" class="label label-primary">Vote</span>
<i class="fa fa-filter text-primary invisible survey_filter" t-att-data-question_id="question.id" t-att-data-answer_id="user_input['answer_id']"></i>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</template>
<!-- Result for matrix -->
<template id="result_matrix" name="Matrix Result">
<t t-set="matrix_result" t-value="prepare_result"/>
<!-- Tabs -->
<ul class="nav nav-tabs hidden-print">
<li class="active">
<a t-att-href="'#graph_question_%d' % question.id" data-toggle="tab">
<i class="fa fa-bar-chart-o"></i>
Graph
</a>
</li>
<li>
<a t-att-href="'#data_question_%d' % question.id" data-toggle="tab">
<i class="fa fa-list-alt"></i>
Data
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active with-3d-shadow with-transitions survey_graph" t-att-id="'graph_question_%d' % question.id" t-att-data-question_id= "question.id" data-graph_type= "multi_bar" t-att-graph-data="graph_data">
<!-- svg element for drawing Multibar chart -->
<svg style="height:20em"></svg>
</div>
<div class="tab-pane" t-att-id="'data_question_%d' % question.id">
<table class="table table-hover table-condensed text-right">
<thead>
<tr>
<th></th>
<th class="text-right" t-foreach="matrix_result['answers']" t-as="answer_id">
<span t-esc="matrix_result['answers'][answer_id]"></span>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="matrix_result['rows']" t-as="row_id">
<td>
<span t-esc="matrix_result['rows'][row_id]"></span>
</td>
<td class="survey_answer" t-foreach="matrix_result['answers']" t-as="answer_id">
<span t-esc="round(matrix_result['result'][(row_id,answer_id)]*100.0/(input_summary['answered'] or 1),2)"></span> %
<span class="label label-primary" t-esc="matrix_result['result'][(row_id,answer_id)]"></span><i class="fa fa-filter text-primary invisible survey_filter" t-att-data-question_id="question.id" t-att-data-row_id="row_id" t-att-data-answer_id="answer_id"></i>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<!-- Result for Numeric Data -->
<template id="result_number" name="Number Result">
<t t-set="number_result" t-value="prepare_result"/>
<t t-set="text_result" t-value="number_result['input_lines']" />
<span class="pull-right mt8">
<span class="label label-default only_left_radius">Maximum </span> <span class="label label-success only_right_radius" t-esc="number_result['max']"></span>
<span class="label label-default only_left_radius">Minimum </span> <span class="label label-danger only_right_radius" t-esc="number_result['min']"></span>
<span class="label label-default only_left_radius">Average </span> <span class="label label-warning only_right_radius" t-esc="number_result['average']"></span>
</span>
<ul class="nav nav-tabs hidden-print">
<li class="active">
<a t-att-href="'#most_common_%d' % question.id" data-toggle="tab">
<i class="fa fa-list-ol"></i>
Most Common <span t-esc="len(number_result['most_comman'])"></span>
</a>
</li>
<li>
<a t-att-href="'#data_question_%d' % question.id" data-toggle="tab">
<i class="fa fa-list-alt"></i>
All Data
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active with-3d-shadow with-transitions" t-att-id="'most_common_%d' % question.id">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>User Responses</th>
<th>Occurence</th>
</tr>
</thead>
<tbody>
<tr t-foreach="number_result['most_comman']" t-as="row">
<td>
<span t-esc="row[0]"></span>
</td>
<td>
<span t-esc="row[1]"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane" t-att-id="'data_question_%d' % question.id">
<table class="table table-hover table-condensed" t-att-id="'table_question_%d' % question.id">
<thead>
<tr>
<th>#</th>
<th>User Responses</th>
</tr>
</thead>
<tbody>
<tr class="hidden" t-foreach="number_result['input_lines']" t-as="user_input">
<td><a t-att-href="'%s/%s' % (user_input.user_input_id.print_url, user_input.user_input_id.token)"><t t-esc="user_input_index + 1"></t></a></td>
<!-- <td><t t-esc="user_input_index+1"></t></td>
--> <td>
<span t-field="user_input.value_number"></span><br/>
</td>
</tr>
</tbody>
</table>
<t t-call="survey.pagination"/>
</div>
</div>
</template>
<template id="no_result" name="Survey Result">
<t t-call="website.layout">
<div class="container">
<h2><span t-field='survey.title'></span></h2>
<div class="jumbotron mt32">
<h2 class="text-muted">
<span>
<i style="font-size:1.8em" class="fa fa-users pull-right"></i>
</span>
Sorry, No one answered this survey yet
</h2>
</div>
</div>
</t>
</template>
<!-- Pagination Element -->
<template id="pagination" name="Survey Result">
<t t-set="record_limit" t-value="10"/><!-- Change This record_limit to change number of record per page-->
<ul t-att-id="'pagination_%d' % question.id" class="pagination" t-att-data-question_id="question.id" t-att-data-record_limit="record_limit">
<t t-if="len(text_result) > record_limit">
<li t-foreach="page_range(len(text_result), record_limit)" t-as="num">
<a href="#" t-esc="num"></a>
</li>
</t>
</ul>
</template>
</data>
</openerp>

View File

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- "Thank you" message when the survey is completed -->
<template id="sfinished" name="Survey Finished">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="jumbotron mt32">
<h1>Thank you!</h1>
<div t-field="survey.thank_you_message" />
<div t-if='survey.quizz_mode'>You scored <t t-esc="user_input.quizz_score" /> points.</div>
<div>If you wish, you can <a t-att-href="'/survey/print/%s/%s' % (slug(survey), token)">print your answers</a>.</div>
</div>
</div>
</div>
</t>
</template>
<!-- Message when the survey is not open -->
<template id="notopen" name="Survey not open">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="jumbotron mt32">
<h1>Not open</h1>
<p>This survey is not open. Thank you for your interest!</p>
</div>
</div>
</div>
</t>
</template>
<!-- Message when the survey has no pages -->
<template id="nopages" name="Survey has no pages">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="jumbotron mt32">
<h1>Not ready</h1>
<p>This survey has no pages by now!</p>
</div>
</div>
</div>
</t>
</template>
<!-- First page of a survey -->
<template id="survey_init" name="Survey">
<t t-call="website.layout">
<div class="wrap">
<div class="oe_structure" />
<div class="container">
<div groups="base.group_website_publisher" t-ignore="true" class="text-right">
<a href="/web#action=survey.action_survey_form" class="btn btn-default">Go back to surveys</a>
</div>
<div class='jumbotron mt32'>
<h1 t-field='survey.title' />
<div t-field='survey.description' />
<a class="btn btn-primary btn-lg" t-att-href="'/survey/fill/%s/%s' % (slug(survey), token)">
Start Survey
</a>
</div>
</div>
<div class="oe_structure" />
</div>
</t>
</template>
<!-- A survey -->
<template id="survey" name="Survey">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/survey/static/src/js/survey.js" />
</t>
<div class="wrap">
<div class="oe_structure"/>
<div class="container">
<div groups="base.group_website_publisher" t-ignore="true" class="text-right">
<a href="/web#action=survey.action_survey_form" class="btn btn-default">Go back to surveys</a>
</div>
<t t-call="survey.page" />
</div>
<div class="oe_structure"/>
</div>
</t>
</template>
<!-- A page -->
<template id="page" name="Page">
<div class="page-header">
<p class="pull-right">Page <span t-raw='page_nr + 1'/> on <span t-raw="len(survey.page_ids)"/></p>
<h1 t-field='page.title' />
<div t-field='page.description'/>
</div>
<form role="form" method="post" class="js_surveyform" t-att-name="'%s_%s' % (survey.id, page.id)" t-att-action="'/survey/fill/%s/%s' % (slug(survey), token)" t-att-data-prefill="'/survey/prefill/%s/%s/%s' % (slug(survey), token, slug(page))" t-att-data-validate="'/survey/validate/%s' % (slug(survey))" t-att-data-submit="'/survey/submit/%s' % (slug(survey))">
<input type="hidden" name="page_id" t-att-value="page.id" />
<input type="hidden" name="token" t-att-value="token" />
<t t-foreach='page.question_ids' t-as='question'>
<t t-set="prefix" t-value="'%s_%s_%s' % (survey.id, page.id, question.id)" />
<div class="js_question-wrapper" t-att-id="prefix">
<h2>
<span t-field='question.question' />
<span t-if="question.constr_mandatory" class="text-danger">*</span>
</h2>
<div t-field='question.description' class="text-muted"/>
<t t-if="question.type == 'free_text'"><t t-call="survey.free_text"/></t>
<t t-if="question.type == 'textbox'"><t t-call="survey.textbox"/></t>
<t t-if="question.type == 'numerical_box'"><t t-call="survey.numerical_box"/></t>
<t t-if="question.type == 'datetime'"><t t-call="survey.datetime"/></t>
<t t-if="question.type == 'simple_choice'"><t t-call="survey.simple_choice"/></t>
<t t-if="question.type == 'multiple_choice'"><t t-call="survey.multiple_choice"/></t>
<t t-if="question.type == 'matrix'"><t t-call="survey.matrix"/></t>
<div class="js_errzone alert alert-danger" style="display:none;"></div>
</div>
</t>
<div class="text-center mt16 mb16">
<button t-if="survey.users_can_go_back and page_nr > 0" type="submit" class="btn btn-default" name="button_submit" value="previous">Previous page</button>
<button t-if="not last" type="submit" class="btn btn-primary" name="button_submit" value="next">Next page</button>
<button t-if="last" type="submit" class="btn btn-primary" name="button_submit" value="finish">Submit survey</button>
</div>
</form>
<!-- Modal used to display error message, i.c.o. ajax error -->
<div class="modal fade" id="AJAXErrorModal" role="dialog" aria-labelledby="AJAXErrorModal" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&amp;times;</button>
<h4 class="modal-title">A problem has occured</h4>
</div>
<div class="modal-body"><p>Something went wrong while contacting survey server. <strong class="text-danger">Your answers have probably not been recorded.</strong> Try refreshing.</p></div>
<div class="modal-footer"><button type="button" class="btn btn-primary" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</template>
<!-- Question widgets -->
<template id="free_text" name="Free text box">
<textarea class="form-control" rows="3" t-att-name="prefix"></textarea>
</template>
<template id="textbox" name="Text box">
<input type="text" class="form-control" t-att-name="prefix"/>
</template>
<template id="numerical_box" name="Numerical box">
<input type="number" step="any" class="form-control" t-att-name="prefix"/>
</template>
<template id="datetime" name="Datetime box">
<input type="text" class="form-control" t-att-name="prefix" placeholder="yyyy-mm-dd hh:mm:ss" />
</template>
<template id="simple_choice" name="Simple choice">
<div t-if="question.display_mode == 'dropdown'" class="js_drop row">
<div class="col-md-12">
<select class="form-control" t-att-name="prefix">
<option disabled="1" selected="1" value="">Choose...</option>
<t t-foreach='question.labels_ids' t-as='label'>
<option t-att-value='label.id'><t t-esc='label.value'/></option>
</t>
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
<option class="js_other_option" value="-1"><span t-esc="question.comments_message" /></option>
</t>
</select>
</div>
<div t-if='question.comments_allowed and question.comment_count_as_answer' class="col-md-6">
<input type="text" class="form-control" t-att-name="'%s_%s' % (prefix, 'comment')" data-oe-survey-othert="1"/>
</div>
<div t-if='question.comments_allowed and not question.comment_count_as_answer' class="col-md-12 mt16">
<span t-field="question.comments_message"/>
<input type="text" class="form-control" t-att-name="'%s_%s' % (prefix, 'comment')"/>
</div>
</div>
<div t-if="question.display_mode == 'columns' " class="row js_radio">
<div t-foreach='question.labels_ids' t-as='label' t-attf-class="col-md-#{question.column_nb}">
<label>
<input type="radio" t-att-name="prefix" t-att-value='label.id' />
<span t-field='label.value'/>
</label>
</div>
<div t-if='question.comments_allowed and question.comment_count_as_answer' class="js_comments col-md-12" >
<label>
<input type="radio" t-att-name="prefix" value="-1"/>
<span t-field="question.comments_message" />
</label>
<input type="text" class="form-control" t-att-name="'%s_%s' % (prefix, 'comment')"/>
</div>
<div t-if='question.comments_allowed and not question.comment_count_as_answer' class="col-md-12">
<span t-field="question.comments_message"/>
<input type="text" class="form-control" t-att-name="'%s_%s' % (prefix, 'comment')" data-oe-survey-othert="1"/>
</div>
</div>
</template>
<template id="multiple_choice" name="Multiple choice">
<div class="row">
<div t-foreach='question.labels_ids' t-as='label' t-attf-class="col-md-#{question.column_nb}">
<label>
<input type="checkbox" t-att-name="'%s_%s' % (prefix, label.id)" t-att-value='label.id' />
<span t-field='label.value'/>
</label>
</div>
<div t-if='question.comments_allowed and question.comment_count_as_answer' class="js_ck_comments col-md-12" >
<label>
<input type="checkbox" t-att-name="'%s_%s' % (prefix, -1)" value="-1" />
<span t-field="question.comments_message" />
</label>
<input type="text" class="form-control" t-att-name="'%s_%s' % (prefix, 'comment')"/>
</div>
<div t-if='question.comments_allowed and not question.comment_count_as_answer' class="col-md-12">
<span t-field="question.comments_message"/>
<input type="text" class="form-control" t-att-name="'%s_%s' % (prefix, 'comment')" data-oe-survey-othert="1"/>
</div>
</div>
</template>
<template id="matrix" name="Matrix">
<table class="table table-hover">
<thead>
<tr>
<th> </th>
<th t-foreach="question.labels_ids" t-as="col_label"><span t-field="col_label.value" /></th>
</tr>
</thead>
<tbody>
<tr t-foreach="question.labels_ids_2" t-as="row_label">
<th><span t-field="row_label.value" /></th>
<td t-foreach="question.labels_ids" t-as="col_label">
<input t-if="question.matrix_subtype == 'simple'" type="radio" t-att-name="'%s_%s' % (prefix, row_label.id)" t-att-value='col_label.id' />
<input t-if="question.matrix_subtype == 'multiple'" type="checkbox" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value='col_label.id' />
</td>
</tr>
</tbody>
</table>
<div t-if='question.comments_allowed'>
<span t-field="question.comments_message"/>
<input type="text" class="form-control" t-att-name="'%s_%s' % (prefix, 'comment')" />
</div>
</template>
<!-- Printable view of a survey (all pages) -->
<template id="survey_print" name="Survey">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/survey/static/src/js/survey.js" />
</t>
<div class="wrap">
<div class="container">
<div class="row">
<div class='jumbotron mt32'>
<h1><span t-field='survey.title'/></h1>
<t t-if="survey.description"><div t-field='survey.description'/></t>
</div>
<form role="form" method="post" class="js_surveyform" t-att-name="'%s' % (survey.id)" t-att-data-prefill="'/survey/prefill/%s/%s' % (slug(survey), token)">
<t t-foreach="survey.page_ids" t-as="page">
<div class="page-header">
<h1 t-field='page.title' />
<t t-if="page.description"><div t-field='page.description'/></t>
</div>
<t t-foreach='page.question_ids' t-as='question'>
<t t-set="prefix" t-value="'%s_%s_%s' % (survey.id, page.id, question.id)" />
<div class="js_question-wrapper" t-att-id="prefix">
<h2>
<span t-field='question.question' />
<span t-if="question.constr_mandatory" class="text-danger">*</span>
</h2>
<t t-if="question.description"><div class="text-muted" t-field='question.description' /></t>
<t t-if="question.type == 'free_text'"><t t-call="survey.free_text"/></t>
<t t-if="question.type == 'textbox'"><t t-call="survey.textbox"/></t>
<t t-if="question.type == 'numerical_box'"><t t-call="survey.numerical_box"/></t>
<t t-if="question.type == 'datetime'"><t t-call="survey.datetime"/></t>
<t t-if="question.type == 'simple_choice'"><t t-call="survey.simple_choice"/></t>
<t t-if="question.type == 'multiple_choice'"><t t-call="survey.multiple_choice"/></t>
<t t-if="question.type == 'matrix'"><t t-call="survey.matrix"/></t>
<div class="js_errzone alert alert-danger" style="display:none;"></div>
</div>
</t>
<hr/>
</t>
</form>
</div>
</div>
</div>
</t>
</template>
</data>
</openerp>

View File

@ -0,0 +1,532 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- USER INPUTS -->
<record id="survey_user_input_search" model="ir.ui.view">
<field name="name">survey_user_input_search</field>
<field name="model">survey.user_input</field>
<field name="arch" type="xml">
<search string="Search Survey">
<field name="survey_id"/>
<field name="email"/>
<field name="partner_id"/>
<filter string="Completed" domain="[('state', '=', 'done')]"/>
<filter string="Partially completed" domain="[('state', '=', 'skip')]"/>
<filter string="New" domain="[('state', '=', 'new')]"/>
<filter string="Test" domain="[('state','=', 'test')]"/>
<group expand="0" string="Group By...">
<filter name="group_by_survey" string="Survey" domain="[]" context="{'group_by': 'survey_id'}"/>
<filter string="Email" domain="[]" context="{'group_by': 'email'}"/>
<filter string="Partner" domain="[]" context="{'group_by': ['partner_id']}"/>
</group>
</search>
</field>
</record>
<record model="ir.ui.view" id="survey_user_input_form">
<field name="name">survey_user_input_form</field>
<field name="model">survey.user_input</field>
<field name="arch" type="xml">
<form string="Survey User inputs" version="7.0" create="false">
<header>
<button name="action_survey_resent" string="Sent Invitation Again" type="object" class="oe_highlight" attrs="{'invisible': ['|', ('type','=','manually'), ('state', '=', 'done')]}"/>
<button name="action_view_answers" states="done" string="Print These Answers" type="object" class="oe_highlight" />
<button name="action_survey_results" string="View Results" type="object" />
<field name="state" widget="statusbar"/>
</header>
<sheet>
<div class="oe_right oe_button_box" name="button_box">
</div>
<group col="2">
<group>
<field name="survey_id"/>
<field name="date_create"/>
<field name="type"/>
<field name="token" groups="base.group_no_one"/>
</group>
<group>
<field name="deadline"/>
<field name="partner_id"/>
<field name="email" widget="email"/>
<field name="test_entry" groups="base.group_no_one"/>
<field name="quizz_score" groups="base.group_no_one"/>
</group>
</group>
<field name="user_input_line_ids" mode="tree" attrs="{'readonly': False}">
<tree>
<field name="page_id"/>
<field name="question_id"/>
<field name="answer_type"/>
<field name="skipped"/>
<field name="date_create"/>
<field name="quizz_mark" groups="base.group_no_one"/>
</tree>
</field>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="survey_user_input_tree">
<field name="name">survey_user_input_tree</field>
<field name="model">survey.user_input</field>
<field name="arch" type="xml">
<tree string="Survey User inputs" version="7.0" colors="lightgrey:test_entry == True" create="false">
<field name="survey_id"/>
<field name="date_create"/>
<field name="deadline"/>
<field name="partner_id"/>
<field name="email"/>
<field name="type"/>
<field name="state"/>
<field name="test_entry" invisible="True"/>
<field name="quizz_score" groups="base.group_no_one"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_survey_user_input">
<field name="name">Answers</field>
<field name="res_model">survey.user_input</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="survey_user_input_tree"></field>
<field name="search_view_id" ref="survey_user_input_search"/>
<field name="context">{'search_default_group_by_survey': True}</field>
<field name="help" type="html">
<p>Nobody has replied to your surveys yet.</p>
</field>
</record>
<record id="action_selected_survey_user_input" model="ir.actions.act_window">
<field name="name">Survey User input</field>
<field name="res_model">survey.user_input</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="survey_user_input_tree"></field>
<field name="search_view_id" ref="survey_user_input_search"/>
<field name="context">{'search_default_survey_id': active_id, 'default_survey_id': active_id}</field>
<field name="help" type="html">
<p>Nobody has replied to your survey yet.</p>
</field>
</record>
<!-- SURVEY -->
<record model="ir.ui.view" id="survey_form">
<field name="name">Form view for survey</field>
<field name="model">survey.survey</field>
<field name="arch" type="xml">
<form string="Survey" version="7.0">
<header groups="base.group_survey_manager">
<button name="action_test_survey" string="Test Survey" type="object"/>
<button name="action_print_survey" string="Print Survey" type="object"/>
<button name="action_send_survey" string="Share and invite by email" type="object" class="oe_highlight" />
<button name="action_result_survey" string="View results" type="object" class="oe_highlight" />
<field name="stage_id" widget="statusbar" clickable="True" />
</header>
<sheet>
<div class="oe_title" style="width: 100%;">
<label for="title" class="oe_edit_only"/>
<h1><field name="title" /></h1>
</div>
<notebook>
<page string="Edit Pages and Questions">
<field name="page_ids" mode="tree" context="{'default_survey_id': active_id}" nolabel="1">
<tree>
<field name="sequence" widget="handle"/>
<field name="title"/>
<field name="question_ids"/>
</tree>
</field>
</page>
<page string="Select Options">
<group colspan="4">
<field name="users_can_go_back" string="User can come back in the previous page" />
<field name="auth_required" />
<field name="res_model" groups="base.group_no_one"/>
<field name="quizz_mode" groups="base.group_no_one"/>
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record model="ir.ui.view" id= "survey_tree">
<field name="name">Tree view for survey</field>
<field name="model">survey.survey</field>
<field name="arch" type="xml">
<tree string="Survey">
<field name="title" />
<field name="stage_id" />
<field name="tot_sent_survey" string="Invitations sent" />
<field name="tot_start_survey" string="Started" />
<field name="tot_comp_survey" string="Completed" />
</tree>
</field>
</record>
<record model="ir.ui.view" id="survey_kanban">
<field name="name">Kanban view for survey</field>
<field name="model">survey.survey</field>
<field name="arch" type="xml">
<kanban default_group_by="stage_id">
<field name="stage_id" />
<field name="designed" />
<field name="title" />
<field name="tot_sent_survey" />
<field name="tot_start_survey" />
<field name="tot_comp_survey" />
<field name="color" />
<field name="auth_required" />
<field name="public_url" />
<templates>
<div t-name="kanban-box" t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card">
<div class="oe_dropdown_toggle oe_dropdown_kanban" t-if="widget.view.is_action_enabled('edit')">
<span class="oe_e">í</span> <!-- icon for dropdown menu -->
<ul class="oe_dropdown_menu">
<li><a type="edit">Survey Options</a></li>
<li t-if="widget.view.is_action_enabled('delete')"><a type="delete">Delete!</a></li>
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
</ul>
</div>
<div class="oe_kanban_content">
<h4 class="oe_center"><field name="title" /></h4>
<div><ul>
<li>
<a name="action_test_survey" type="object">Design</a>
</li>
<li>
<t t-if="record.designed.raw_value"><a type="object" name="action_test_survey">Test</a></t>
<t t-if="! record.designed.raw_value"><a style="color: #aaaaaa;">Test</a></t>
</li>
<li>
<t t-if="record.designed.raw_value"><a type="object" name="action_send_survey">Share &amp;amp; Invite</a></t>
<t t-if="! record.designed.raw_value"><a style="color: #aaaaaa;">Share &amp;amp; Invite</a></t>
</li>
<li>
<t t-if="record.tot_start_survey.raw_value &gt; 0"><a name="action_result_survey" type="object">Analyse Answers</a> <span t-if="record.tot_start_survey.raw_value &gt; 0">(<field name="tot_start_survey" />)</span></t>
<t t-if="record.tot_start_survey.raw_value &lt;= 0"><a style="color: #aaaaaa;">Analyse Answers</a></t>
</li>
</ul></div>
</div>
</div>
</templates>
</kanban>
</field>
</record>
<record model="ir.actions.act_window" id="action_survey_form">
<field name="name">Surveys</field>
<field name="res_model">survey.survey</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Click to add a survey.</p>
<p>You can create surveys for different purposes: customer opinion, services feedback, recruitment interviews, employee's periodical evaluations, marketing campaigns, etc.</p>
<p>Design easily your survey, send invitations to answer by email and analyse answers.</p>
</field>
</record>
<act_window context="{'search_default_survey_id': [active_id], 'default_survey_id': active_id}" id="act_survey_pages" name="Pages" res_model="survey.page" src_model="survey.survey"/>
<act_window context="{'search_default_survey_id': [active_id], 'default_survey_id': active_id}" id="act_survey_question" name="Questions" res_model="survey.question" src_model="survey.survey"/>
<!-- PAGES -->
<record model="ir.ui.view" id="survey_page_form">
<field name="name">Form view for survey page</field>
<field name="model">survey.page</field>
<field name="arch" type="xml">
<form string="Survey Page" version="7.0" create="false">
<sheet>
<div class="oe_title" style="width: 100%;">
<label for="title" class="oe_edit_only"/>
<h1><field name="title"/></h1>
</div>
<field name="question_ids" nolabel="1" mode="tree" context="{'default_page_id': active_id}">
<tree>
<field name="sequence" widget="handle"/>
<field name="question"/>
<field name="type"/>
<field name="constr_mandatory"/>
</tree>
</field>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="survey_page_tree">
<field name="name">Tree view for survey page</field>
<field name="model">survey.page</field>
<field name="arch" type="xml">
<tree string="Survey Page" create="false">
<field name="sequence" widget="handle"/>
<field name="title"/>
<field name="survey_id"/>
<field name="question_ids" string="#Questions"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="survey_page_search" >
<field name="name">Search view for survey page</field>
<field name="model">survey.page</field>
<field name="arch" type="xml">
<search string="Search Page">
<field name="title" string="Page"/>
<field name="survey_id" string="Survey"/>
<group expand="0" string="Group By...">
<filter name="group_by_survey" string="Survey" domain="[]" context="{'group_by':'survey_id'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_survey_page_form">
<field name="name">Pages</field>
<field name="res_model">survey.page</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="survey_page_search"/>
<field name="context">{'search_default_group_by_survey': True}</field>
</record>
<act_window context="{'search_default_page_id': active_id, 'default_page_id': active_id}" id="act_survey_page_question" name="Questions" res_model="survey.question" src_model="survey.page"/>
<!-- QUESTIONS -->
<record model="ir.ui.view" id="survey_question_form">
<field name="name">Form view for survey question</field>
<field name="model">survey.question</field>
<field name="arch" type="xml">
<form string="Survey Question" version="7.0" create="false">
<sheet>
<div class="oe_title" style="width: 100%;">
<label for="question" string="Question name" class="oe_edit_only"/>
<h1><field name="question" colspan="4"/></h1>
<separator />
</div>
<group>
<field name="type" widget="radio" />
</group>
<notebook>
<page string="Answers">
<field name="validation_email" attrs="{'invisible': [('type', '!=', 'textbox')]}"/>
<label for="validation_email" attrs="{'invisible': [('type', '!=', 'textbox')]}"/>
<separator />
<label for="labels_ids" attrs="{'invisible': [('type', 'not in', ['simple_choice', 'multiple_choice', 'matrix'])]}" />
<field name="labels_ids" string="Type of answers" context="{'default_question_id': active_id}" attrs="{'invisible': [('type', 'not in', ['simple_choice', 'multiple_choice', 'matrix'])]}">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="value" string="Answers"/>
</tree>
</field>
<separator />
<label for="labels_ids_2" attrs="{'invisible': [('type', '!=', 'matrix')]}" />
<field name="labels_ids_2" context="{'default_question_id_2': active_id}" attrs="{'invisible': [('type', '!=', 'matrix')]}">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="value" string="Answers"/>
</tree>
</field>
</page>
<page string="Options">
<group string="Constraints" >
<field name="constr_mandatory" string="Mandatory Answer"/>
<field name="constr_error_msg" attrs="{'invisible': [('constr_mandatory', '=', False)]}"/>
<group colspan="2" nolabel="1" attrs="{'invisible': [('type', 'not in', ['textbox', 'numerical_box', 'datetime'])]}">
<field name="validation_required"/>
<group colspan="2" nolabel="1" attrs="{'invisible': [('validation_required', '=', False)]}">
<field name="validation_length_min" attrs="{'invisible': [('type', '!=', 'textbox')]}"/>
<field name="validation_length_max" attrs="{'invisible': [('type', '!=', 'textbox')]}"/>
<field name="validation_min_float_value" attrs="{'invisible': [('type', '!=', 'numerical_box')]}"/>
<field name="validation_max_float_value" attrs="{'invisible': [('type', '!=', 'numerical_box')]}"/>
<field name="validation_min_date" attrs="{'invisible': [('type', '!=', 'datetime')]}"/>
<field name="validation_max_date" attrs="{'invisible': [('type', '!=', 'datetime')]}"/>
<field name="validation_error_msg" />
</group>
</group>
<field name="matrix_subtype" attrs="{'invisible':[('type','not in',['matrix'])]}"/>
</group>
<group string="Display mode" attrs="{'invisible':[('type','not in',['simple_choice', 'multiple_choice'])]}">
<field name="display_mode" string="Format" attrs="{'invisible':[('type','not in',['simple_choice'])]}"/>
<field name="column_nb" string="Number of columns" attrs="{'invisible':[('display_mode','=','dropdown'), ('type','=','simple_choice')]}"/>
</group>
<group string="Allow Comments" attrs="{'invisible':[('type','not in',['simple_choice','multiple_choice', 'matrix'])]}">
<field name='comments_allowed' />
<field name='comments_message' attrs="{'invisible': [('comments_allowed', '=', False)]}"/>
<field name='comment_count_as_answer' attrs="{'invisible': ['|', ('comments_allowed', '=', False), ('type', 'in', ['matrix'])]}" />
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="survey_question_tree">
<field name="name">Tree view for survey question</field>
<field name="model">survey.question</field>
<field name="arch" type="xml">
<tree string="Survey Question" create="false">
<field name="sequence" widget="handle"/>
<field name="question"/>
<field name="page_id"/>
<field name="survey_id"/>
<field name="type"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="survey_question_search">
<field name="name">Search view for survey question</field>
<field name="model">survey.question</field>
<field name="arch" type="xml">
<search string="Search Question">
<field name="question" string="Question"/>
<field name="survey_id" string="Survey"/>
<field name="page_id" string="Page"/>
<field name="type" string="Type"/>
<group expand="1" string="Group By...">
<filter name="group_by_page" string="Page" domain="[]" context="{'group_by':'page_id'}"/>
<filter name="group_by_type" string="Type" domain="[]" context="{'group_by':'type'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_survey_question_form">
<field name="name">Questions</field>
<field name="res_model">survey.question</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="survey_question_search"/>
<field name="context">{'search_default_group_by_page': True}</field>
</record>
<!-- LABELS -->
<record model="ir.ui.view" id="survey_label_tree">
<field name="name">survey_label_tree</field>
<field name="model">survey.label</field>
<field name="arch" type="xml">
<tree string="Survey Label" create="false">
<field name="sequence" widget="handle"/>
<field name="question_id"/>
<field name="question_id_2"/>
<field name="value"/>
<field name="quizz_mark" groups="base.group_no_one"/>
</tree>
</field>
</record>
<record id="survey_label_search" model="ir.ui.view">
<field name="name">survey_label_search</field>
<field name="model">survey.label</field>
<field name="arch" type="xml">
<search string="Search Label">
<field name="question_id" string="Question"/>
<filter name="group_by_question" string="Question" domain="[]" context="{'group_by':'question_id'}"/>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_survey_label_form">
<field name="name">Labels</field>
<field name="res_model">survey.label</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="survey_label_search"/>
<field name="context">{'search_default_group_by_question': True}</field>
</record>
<!-- USER INPUT LINES
.. note:: these views are useful mainly for technical users/administrators -->
<record model="ir.ui.view" id="survey_user_input_line_form">
<field name="name">survey_user_input_line_form</field>
<field name="model">survey.user_input_line</field>
<field name="arch" type="xml">
<form string="User input line details" version="7.0" create="false">
<sheet>
<group col="4">
<field name="question_id"/>
<field name="date_create"/>
<field name="answer_type"/>
<field name="skipped" />
<field name="quizz_mark" groups="base.group_no_one"/>
</group>
<group>
<field name="value_text" colspan='2' attrs="{'invisible': [('answer_type','!=','text')]}"/>
<field name="value_number" colspan='2' attrs="{'invisible': [('answer_type','!=','number')]}"/>
<field name="value_date" colspan='2' attrs="{'invisible': [('answer_type','!=','date')]}"/>
<field name="value_free_text" colspan='2' attrs="{'invisible': [('answer_type','!=','free_text')]}"/>
<field name="value_suggested_row" colspan='2' />
<field name="value_suggested" colspan='2' attrs="{'invisible': [('answer_type','!=','suggestion')]}"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="survey_response_line_tree">
<field name="name">survey_response_line_tree</field>
<field name="model">survey.user_input_line</field>
<field name="arch" type="xml">
<tree string="Survey Answer Line" create="false">
<field name="survey_id"/>
<field name="user_input_id"/>
<field name="page_id"/>
<field name="question_id"/>
<field name="date_create"/>
<field name="answer_type"/>
<field name="skipped"/>
<field name="quizz_mark" groups="base.group_no_one"/>
</tree>
</field>
</record>
<record id="survey_response_line_search" model="ir.ui.view">
<field name="name">survey_response_line_search</field>
<field name="model">survey.user_input_line</field>
<field name="arch" type="xml">
<search string="Search User input lines">
<field name="user_input_id"/>
<field name="survey_id"/>
<group expand="1" string="Group By...">
<filter name="group_by_survey" string="Survey" domain="[]" context="{'group_by':'survey_id'}"/>
<filter name="group_by_user_input" string="User Input" domain="[]" context="{'group_by':'user_input_id'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_survey_user_input_line">
<field name="name">Survey User Input lines</field>
<field name="res_model">survey.user_input_line</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="survey_response_line_search"/>
<field name="context">{'search_default_group_by_survey': True, 'search_default_group_by_user_input': True}</field>
</record>
<record model="ir.ui.view" id="survey_stage_form">
<field name="name">Form view for survey stage</field>
<field name="model">survey.stage</field>
<field name="arch" type="xml">
<form string="Stage">
<group col='4' colspan='4'>
<field name="name" />
<field name="closed" />
<field name="sequence" />
<field name="fold" />
</group>
</form>
</field>
</record>
<!-- MENU ELEMENTS -->
<!-- Left menu categories-->
<menuitem name="Surveys" id="menu_surveys" parent="base.marketing_menu" sequence="25" groups="base.group_survey_user"/>
<menuitem name="Configuration" id="base.menu_marketing_config_root" parent="base.marketing_menu" sequence="30" />
<!-- Left menu elements: Survey -->
<menuitem name="Surveys" id="menu_survey_form" action="action_survey_form" parent="menu_surveys" sequence="1"/>
<menuitem name="Answers" id="menu_survey_type_form1" action="action_survey_user_input" parent="menu_surveys" sequence="1"/>
<!-- Left menu elements: Technical Configuration -->
<menuitem name="Surveys" id="menu_surveys_configuration" parent="base.menu_marketing_config_root" groups="base.group_no_one" sequence="25" />
<menuitem name="Pages" id="menu_survey_page_form1" action="action_survey_page_form" parent="menu_surveys_configuration" sequence="1"/>
<menuitem name="Questions" id="menu_survey_question_form1" action="action_survey_question_form" parent="menu_surveys_configuration" sequence="2"/>
<menuitem name="Labels" id="menu_survey_label_form1" action="action_survey_label_form" parent="menu_surveys_configuration" sequence="3"/>
<menuitem name="User Input Lines" id="menu_survey_response_line_form" action="action_survey_user_input_line" parent="menu_surveys_configuration" sequence="4"/>
</data>
</openerp>

View File

@ -19,12 +19,4 @@
#
##############################################################################
import survey_send_invitation
import survey_print_statistics
import survey_print_answer
import survey_browse_answer
import survey_selection
import survey_answer
import survey_print
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import survey_email_compose_message

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--
Survey Question Wizard
-->
<record id="view_survey_question_message" model="ir.ui.view">
<field name="name">Survey Answer</field>
<field name="model">survey.question.wiz</field>
<field name="arch" type="xml">
<form string="Your Messages" version="7.0">
<field name="name" nolabel="1" colspan="4" />
</form>
</field>
</record>
<record id="view_survey_question_message1" model="ir.ui.view">
<field name="name">Survey Search</field>
<field name="model">survey.question.wiz</field>
<field name="arch" type="xml">
<search string="Your Messages">
<field name="name"/>
</search>
</field>
</record>
<record id="action_view_survey_question_message" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="res_model">survey.question.wiz</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,59 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
class survey_browse_answer(osv.osv_memory):
_name = 'survey.browse.answer'
_columns = {
'survey_id': fields.many2one('survey', "Survey", required="1"),
'response_id': fields.many2one("survey.response", "Survey Answers", help="If this field is empty, all answers of the selected survey will be print."),
}
def action_next(self, cr, uid, ids, context=None):
"""
Open Browse Response wizard. if you select only survey_id then this wizard open with all response_ids and
if you select survey_id and response_id then open the particular response of the survey.
"""
if context is None: context = {}
record = self.read(cr, uid, ids, [])
record = record and record[0] or {}
if record['response_id']:
res_id = [(record.get('response_id') and record['response_id'][0])]
else:
sur_response_obj = self.pool.get('survey.response')
res_id = sur_response_obj.search(cr, uid, [('survey_id', '=', record['survey_id'][0])])
context.update({'active' : True,'survey_id' : record['survey_id'][0], 'response_id' : res_id, 'response_no' : 0})
search_obj = self.pool.get('ir.ui.view')
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'survey.question.wiz',
'type': 'ir.actions.act_window',
'target': 'new',
'search_view_id':search_id[0],
'context' : context
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,42 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--
Browse Response Wizard (Survey Browse answer)
-->
<record id="view_survey_answer" model="ir.ui.view">
<field name="name">Survey</field>
<field name="model">survey.browse.answer</field>
<field name="arch" type="xml">
<form string="Survey" version="7.0">
<group col="4">
<field name="survey_id"/>
<field name="response_id" domain="[('survey_id','=', survey_id)]"/>
</group>
<footer>
<button name="action_next" string="Start" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_browse_survey_response"
model="ir.actions.act_window">
<field name="name">Answer Survey</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">survey.browse.answer</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem name="Browse Answers" id="menu_browse_survey_response"
action="action_browse_survey_response" parent="base.next_id_10"
groups="base.group_tool_manager" icon="STOCK_PRINT_PREVIEW"/>
</data>
</openerp>

View File

@ -0,0 +1,225 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
from datetime import datetime
import re
import uuid
import urlparse
emails_split = re.compile(r"[;,\n\r]+")
class survey_mail_compose_message(osv.TransientModel):
_name = 'survey.mail.compose.message'
_inherit = 'mail.compose.message'
_description = 'Email composition wizard for Survey'
_log_access = True
def _get_public_url(self, cr, uid, ids, name, arg, context=None):
res = dict((id, 0) for id in ids)
survey_obj = self.pool.get('survey.survey')
for wizard in self.browse(cr, uid, ids, context=context):
res[wizard.id] = survey_obj.browse(cr, uid, wizard.survey_id, context=context).public_url
return res
def _get_public_url_html(self, cr, uid, ids, name, arg, context=None):
""" Compute if the message is unread by the current user """
urls = self._get_public_url(cr, uid, ids, name, arg, context=context)
for key, url in urls.items():
urls[key] = '<a href="%s">%s</a>' % (url, _("Click here to start survey"))
return urls
_columns = {
'survey_id': fields.many2one('survey.survey', 'Survey', required=True),
'public': fields.selection([('public_link', 'Share the public web link to your audience.'),
('email_public_link', 'Send by email the public web link to your audience.'),
('email_private', 'Send private invitation to your audience (only one response per recipient and per invitation).')],
string='Share options', required=True),
'public_url': fields.function(_get_public_url, string="Public url", type="char"),
'public_url_html': fields.function(_get_public_url_html, string="Public HTML web link", type="char"),
'partner_ids': fields.many2many('res.partner',
'survey_mail_compose_message_res_partner_rel',
'wizard_id', 'partner_id', 'Existing contacts'),
'attachment_ids': fields.many2many('ir.attachment',
'survey_mail_compose_message_ir_attachments_rel',
'wizard_id', 'attachment_id', 'Attachments'),
'multi_email': fields.text(string='List of emails', help="This list of emails of recipients will not converted in contacts. Emails separated by commas, semicolons or newline."),
'date_deadline': fields.date(string="Deadline to which the invitation to respond is valid", help="Deadline to which the invitation to respond for this survey is valid. If the field is empty, the invitation is still valid."),
}
_defaults = {
'public': 'public_link',
'survey_id': lambda self, cr, uid, ctx={}: ctx.get('model') == 'survey.survey' and ctx.get('res_id') or None
}
def default_get(self, cr, uid, fields, context=None):
res = super(survey_mail_compose_message, self).default_get(cr, uid, fields, context=context)
if context.get('active_model') == 'res.partner' and context.get('active_ids'):
res.update({'partner_ids': context.get('active_ids')})
return res
def onchange_multi_email(self, cr, uid, ids, multi_email, context=None):
emails = list(set(emails_split.split(multi_email or "")))
emails_checked = []
error_message = ""
for email in emails:
email = email.strip()
if email:
if not re.search(r"^[^@]+@[^@]+$", email):
error_message += "\n'%s'" % email
else:
emails_checked.append(email)
if error_message:
raise osv.except_osv(_('Warning!'), _("One email at least is incorrect: %s" % error_message))
emails_checked.sort()
values = {'multi_email': '\n'.join(emails_checked)}
return {'value': values}
def onchange_survey_id(self, cr, uid, ids, survey_id, context=None):
""" Compute if the message is unread by the current user. """
if survey_id:
survey = self.pool.get('survey.survey').browse(cr, uid, survey_id, context=context)
return {
'value': {
'subject': survey.title,
'public_url': survey.public_url,
'public_url_html': '<a href="%s">%s</a>' % (survey.public_url, _("Click here to take survey")),
}}
else:
txt = _("Please select a survey")
return {
'value': {
'public_url': txt,
'public_url_html': txt,
}}
#------------------------------------------------------
# Wizard validation and send
#------------------------------------------------------
def send_mail(self, cr, uid, ids, context=None):
""" Process the wizard content and proceed with sending the related
email(s), rendering any template patterns on the fly if needed """
if context is None:
context = {}
survey_response_obj = self.pool.get('survey.user_input')
partner_obj = self.pool.get('res.partner')
mail_mail_obj = self.pool.get('mail.mail')
try:
model, anonymous_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal', 'group_anonymous')
except ValueError:
anonymous_id = None
def create_response_and_send_mail(wizard, token, partner_id, email):
""" Create one mail by recipients and replace __URL__ by link with identification token """
#set url
url = wizard.survey_id.public_url
url = urlparse.urlparse(url).path[1:] # dirty hack to avoid incorrect urls
if token:
url = url + '/' + token
# post the message
values = {
'model': None,
'res_id': None,
'subject': wizard.subject,
'body': wizard.body.replace("__URL__", url),
'body_html': wizard.body.replace("__URL__", url),
'parent_id': None,
'partner_ids': partner_id and [(4, partner_id)] or None,
'notified_partner_ids': partner_id and [(4, partner_id)] or None,
'attachment_ids': wizard.attachment_ids or None,
'email_from': wizard.email_from or None,
'email_to': email,
}
mail_id = mail_mail_obj.create(cr, uid, values, context=context)
mail_mail_obj.send(cr, uid, [mail_id], context=context)
def create_token(wizard, partner_id, email):
if context.get("survey_resent_token"):
response_ids = survey_response_obj.search(cr, uid, [('survey_id', '=', wizard.survey_id.id), ('state', 'in', ['new', 'skip']), '|', ('partner_id', '=', partner_id), ('email', '=', email)], context=context)
if response_ids:
return survey_response_obj.read(cr, uid, response_ids, ['token'], context=context)[0]['token']
if wizard.public != 'email_private':
return None
else:
token = uuid.uuid4().__str__()
# create response with token
survey_response_obj.create(cr, uid, {
'survey_id': wizard.survey_id.id,
'deadline': wizard.date_deadline,
'date_create': datetime.now(),
'type': 'link',
'state': 'new',
'token': token,
'partner_id': partner_id,
'email': email})
return token
for wizard in self.browse(cr, uid, ids, context=context):
# check if __URL__ is in the text
if wizard.body.find("__URL__") < 0:
raise osv.except_osv(_('Warning!'), _("The content of the text don't contain '__URL__'. \
__URL__ is automaticaly converted into the special url of the survey."))
if not wizard.multi_email and not wizard.partner_ids and (context.get('default_partner_ids') or context.get('default_multi_email')):
wizard.multi_email = context.get('default_multi_email')
wizard.partner_ids = context.get('default_partner_ids')
# quick check of email list
emails_list = []
if wizard.multi_email:
emails = list(set(emails_split.split(wizard.multi_email)) - set([partner.email for partner in wizard.partner_ids]))
for email in emails:
email = email.strip()
if re.search(r"^[^@]+@[^@]+$", email):
emails_list.append(email)
# remove public anonymous access
partner_list = []
for partner in wizard.partner_ids:
if not anonymous_id or not partner.user_ids or anonymous_id not in [x.id for x in partner.user_ids[0].groups_id]:
partner_list.append({'id': partner.id, 'email': partner.email})
if not len(emails_list) and not len(partner_list):
if wizard.model == 'res.partner' and wizard.res_id:
return False
raise osv.except_osv(_('Warning!'), _("Please enter at least one valid recipient."))
for email in emails_list:
partner_id = partner_obj.search(cr, uid, [('email', '=', email)], context=context)
partner_id = partner_id and partner_id[0] or None
token = create_token(wizard, partner_id, email)
create_response_and_send_mail(wizard, token, partner_id, email)
for partner in partner_list:
token = create_token(wizard, partner['id'], partner['email'])
create_response_and_send_mail(wizard, token, partner['id'], partner['email'])
return {'type': 'ir.actions.act_window_close'}

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--Survey send invitation by email: template -->
<record id="email_template_survey" model="email.template">
<field name="name">Survey - Send by Email</field>
<field name="model_id" ref="model_survey_survey" />
<field name="auto_delete" eval="True" />
<field name="body_html">
<![CDATA[
<div style="font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); ">
<p>Hello,</p>
<p>We are conducting a survey, and your response would be appreciated.</p>
<p><a href="__URL__">Please, click here to start survey</a></p>
<p>Thanks for your participation!</p>
</div>
]]>
</field>
</record>
<!-- Replace the default mass-mailing wizard in base with the composition wizard -->
<act_window name="Partner Survey Mailing" res_model="survey.mail.compose.message" src_model="res.partner" view_mode="form" multi="True" target="new" key2="client_action_multi" id="survey.action_partner_survey_mail" context="{'default_use_template': True, 'default_template_id': ref('email_template_survey')}" />
<!-- Composition form (context['survey_resent_token'], if True, hide share option, emails list and partner_ids) -->
<record model="ir.ui.view" id="survey_email_compose_message">
<field name="name">survey.mail.compose.message.form</field>
<field name="model">survey.mail.compose.message</field>
<field name="arch" type="xml">
<form string="Compose Email" version="7.0">
<field name="composition_mode" invisible="1"/>
<field name="model" invisible="1"/>
<field name="res_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<group col="2">
<field name="survey_id" readonly="context.get('default_survey_id')" on_change="onchange_survey_id(survey_id)" />
<field name="public" widget="radio" invisible="context.get('survey_resent_token')" />
</group>
<group col="1" invisible="context.get('survey_resent_token')" attrs="{'invisible':[('public','in',['email_private', 'email_public_link'])]}" class="oe_survey_email_public">
<div>
You can share your survey web public link and/or send private invitations to your audience. People can answer once per invitation, and whenever they want with the public web link (in this case, the "Public in website" setting must be enabled).
</div>
<div>Copy, paste and share the web link below to your audience.</div>
<code><field name="public_url"/></code>
<div>Copy and paste the HTML code below to add this web link to any webpage.</div>
<code><field name="public_url_html" /></code>
</group>
<group col="1" attrs="{'invisible':['|',('public','=',False),('public','in',['public_link'])]}">
<group col="2">
<field invisible="context.get('survey_resent_token')" name="partner_ids" widget="many2many_tags_email" placeholder="Add list of existing contacts..." context="{'force_email':True, 'show_email':True}" />
<field invisible="context.get('survey_resent_token')" name="multi_email" placeholder="Add list of email of recipients (will not converted in partner), separated by commas, semicolons or newline..." on_change="onchange_multi_email(multi_email)" no_resize="1" />
<field name="subject" placeholder="Subject..."/>
</group>
<field name="body" />
<group col="2">
<div>
<label for="attachment_ids" />
<field name="attachment_ids" widget="many2many_binary" />
</div>
<div class="oe_survey_date_deadline">
<label for="date_deadline" />
<field name="date_deadline" />
</div>
</group>
</group>
<footer attrs="{'invisible':[('public','in',['email_private', 'email_public_link'])]}">
<button string="Close" class="oe_link" special="cancel" />
</footer>
<footer attrs="{'invisible':['|',('public','=',False),('public','in',['public_link'])]}">
<button string="Send" name="send_mail" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
<group class="oe_right" col="1">
<div>
Use template
<field name="template_id" nolabel="1" on_change="onchange_template_id(template_id, composition_mode, model, res_id, context)" />
</div>
<button icon="/email_template/static/src/img/email_template_save.png" type="object" name="save_as_template" string="Save as new template" class="oe_link" help="Save as a new template" />
</group>
</footer>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -1,67 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
from openerp.tools.translate import _
class survey_print(osv.osv_memory):
_name = 'survey.print'
_columns = {
'survey_ids': fields.many2many('survey', string="Survey", required="1"),
'orientation' : fields.selection([('vertical','Portrait(Vertical)'),\
('horizontal','Landscape(Horizontal)')], 'Orientation'),
'paper_size' : fields.selection([('letter','Letter (8.5" x 11")'),\
('legal','Legal (8.5" x 14")'),('a4','A4 (210mm x 297mm)')], 'Paper Size'),
'page_number' : fields.boolean('Include Page Number'),
'without_pagebreak' : fields.boolean('Print Without Page Breaks'),
}
_defaults = {
'orientation': lambda *a:'vertical',
'paper_size': lambda *a:'letter',
'page_number':lambda *a: 0,
'without_pagebreak':lambda *a: 0
}
def action_next(self, cr, uid, ids, context=None):
"""
Print Survey Form(print template of the survey).
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Survey IDs
@param context: A standard dictionary for contextual values
@return : Dictionary value for print survey form.
"""
datas = {'ids' : self.read(cr, uid, ids, ['survey_ids'], context=context)[0]['survey_ids']}
res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size',\
'page_number', 'without_pagebreak'], context=context)
res = res and res[0] or {}
datas['form'] = res
datas['model'] = 'survey.print'
return {
'type': 'ir.actions.report.xml',
'report_name': 'survey.form',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,45 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!-- Survey Print Form View -->
<record id="view_survey_print" model="ir.ui.view">
<field name="name">Survey Print</field>
<field name="model">survey.print</field>
<field name="arch" type="xml">
<form string="Survey Print" version="7.0">
<group col="4">
<separator string="Survey" colspan="4"/>
<field name="survey_ids" nolabel="1" colspan="4" />
<separator string="Print Option" colspan="4"/>
<field name="orientation" colspan="4"/>
<field name="paper_size" colspan="4"/>
<field name="page_number" colspan="4"/>
<field name="without_pagebreak" colspan="4"/>
</group>
<footer>
<button name="action_next" string="Print" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<!-- Survey Print action -->
<record id="action_view_survey_print" model="ir.actions.act_window">
<field name="name">Print Survey</field>
<field name="res_model">survey.print</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem name="Print Surveys" id="menu_print_survey_form" sequence="1"
action="action_view_survey_print" parent="base.next_id_10"
groups="base.group_tool_manager" icon="STOCK_PRINT"/>
</data>
</openerp>

View File

@ -1,72 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
from openerp.tools.translate import _
class survey_print_answer(osv.osv_memory):
_name = 'survey.print.answer'
_columns = {
'response_ids': fields.many2many('survey.response','survey_print_response',\
'response_id','print_id', "Answer", required="1"),
'orientation': fields.selection([('vertical','Portrait(Vertical)'),\
('horizontal','Landscape(Horizontal)')], 'Orientation'),
'paper_size': fields.selection([('letter','Letter (8.5" x 11")'),\
('legal','Legal (8.5" x 14")'),\
('a4','A4 (210mm x 297mm)')], 'Paper Size'),
'page_number': fields.boolean('Include Page Number'),
'without_pagebreak': fields.boolean('Print Without Page Breaks')
}
_defaults = {
'orientation': lambda *a:'vertical',
'paper_size': lambda *a:'letter',
'page_number': lambda *a: 0,
'without_pagebreak': lambda *a: 0
}
def action_next(self, cr, uid, ids, context=None):
"""
Print Survey Answer in pdf format.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of print answer IDs
@param context: A standard dictionary for contextual values
@return : Dictionary value for created survey answer report
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size',\
'page_number', 'without_pagebreak'], context=context)
res = res and res[0] or {}
datas['form'] = res
datas['model'] = 'survey.print.answer'
return {
'type': 'ir.actions.report.xml',
'report_name': 'survey.browse.response',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,45 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!-- Survey Print answer Form View -->
<record id="view_survey_print_answer" model="ir.ui.view">
<field name="name">Survey Print Answer</field>
<field name="model">survey.print.answer</field>
<field name="arch" type="xml">
<form string="Print Answer" version="7.0">
<group col="4">
<separator string="Answer" colspan="4"/>
<field name="response_ids" nolabel="1" colspan="4" />
<separator string="Print Option" colspan="4"/>
<field name="orientation" colspan="4"/>
<field name="paper_size" colspan="4"/>
<field name="page_number" colspan="4"/>
<field name="without_pagebreak" colspan="4"/>
</group>
<footer>
<button name="action_next" string="Print" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<!-- Survey Print answer action -->
<record id="action_view_survey_print_answer"
model="ir.actions.act_window">
<field name="name">Print Answer</field>
<field name="res_model">survey.print.answer</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem name="Surveys Answers" action="action_view_survey_print_answer" id="menu_print_survey_answer"
parent="base.next_id_10" icon="STOCK_PRINT" groups="base.group_tool_manager"/>
</data>
</openerp>

View File

@ -1,37 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!-- Survey Print Statistics Form View -->
<record id="view_survey_print_statistics" model="ir.ui.view">
<field name="name">Survey Print Statistics</field>
<field name="model">survey.print.statistics</field>
<field name="arch" type="xml">
<form string="Survey Print Statistics" version="7.0">
<field name="survey_ids"/>
<footer>
<button name="action_next" string="Print" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<!-- Survey Print Statistics action -->
<record id="action_view_survey_print_statistics"
model="ir.actions.act_window">
<field name="name">Survey Print Statistics</field>
<field name="res_model">survey.print.statistics</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem name="Surveys Statistics" action="action_view_survey_print_statistics" id="menu_print_survey_statistics"
parent="base.next_id_10" icon="STOCK_PRINT" groups="base.group_tool_manager"/>
</data>
</openerp>

View File

@ -1,105 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from lxml import etree
from openerp.osv import fields, osv
from openerp.tools.translate import _
class survey_name_wiz(osv.osv_memory):
_name = 'survey.name.wiz'
_columns = {
'survey_id': fields.many2one('survey', 'Survey', required=True, ondelete='cascade', domain= [('state', '=', 'open')]),
'page_no': fields.integer('Page Number'),
'note': fields.text("Description"),
'page': fields.char('Page Position',size = 12),
'transfer': fields.boolean('Page Transfer'),
'store_ans': fields.text('Store Answer'),
'response': fields.char('Answer',size=16)
}
_defaults = {
'page_no': -1,
'page': 'next',
'transfer': 1,
'response': 0,
'survey_id': lambda self,cr,uid,context:context.get('survey_id',False),
'store_ans': '{}' #Setting the default pattern as '{}' as the field is of type text. The field always gets the value in dict format
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
if uid != 1:
survey_obj = self.pool.get('survey')
line_ids = survey_obj.search(cr, uid, [('invited_user_ids','in',uid)], context=context)
domain = str([('id', 'in', line_ids)])
doc = etree.XML(res['arch'])
nodes = doc.xpath("//field[@name='survey_id']")
for node in nodes:
node.set('domain', domain)
res['arch'] = etree.tostring(doc)
return res
def action_next(self, cr, uid, ids, context=None):
"""
Start the survey, Increment in started survey field but if set the max_response_limit of
survey then check the current user how many times start this survey. if current user max_response_limit
is reach then this user can not start this survey(Raise Exception).
"""
survey_obj = self.pool.get('survey')
search_obj = self.pool.get('ir.ui.view')
if context is None: context = {}
this = self.browse(cr, uid, ids, context=context)[0]
survey_id = this.survey_id.id
context.update({'survey_id': survey_id, 'sur_name_id': this.id})
cr.execute('select count(id) from survey_history where user_id=%s\
and survey_id=%s' % (uid,survey_id))
res = cr.fetchone()[0]
sur_rec = survey_obj.browse(cr,uid,survey_id,context=context)
if sur_rec.response_user and res >= sur_rec.response_user:
raise osv.except_osv(_('Warning!'),_("You cannot give response for this survey more than %s times.") % (sur_rec.response_user))
if sur_rec.max_response_limit and sur_rec.max_response_limit <= sur_rec.tot_start_survey:
raise osv.except_osv(_('Warning!'),_("You cannot give more responses. Please contact the author of this survey for further assistance."))
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'survey.question.wiz',
'type': 'ir.actions.act_window',
'target': 'new',
'search_view_id': search_id[0],
'context': context
}
def on_change_survey(self, cr, uid, ids, survey_id, context=None):
"""
on change event of survey_id field, if note is available in selected survey then display this note in note fields.
"""
if not survey_id:
return {}
notes = self.pool.get('survey').read(cr, uid, survey_id, ['note'])['note']
return {'value': {'note': notes}}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,36 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--
Display Survey List
-->
<record id="view_survey_name" model="ir.ui.view">
<field name="name">Survey</field>
<field name="model">survey.name.wiz</field>
<field name="arch" type="xml">
<form string="Survey" version="7.0">
<group>
<field name="survey_id" on_change="on_change_survey(survey_id)"/>
</group>
<field name="note" placeholder="Add Description" attrs="{'readonly': [('survey_id','=',False)]}"/>
<footer>
<button name="action_next" string="Start" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_view_survey_name"
model="ir.actions.act_window">
<field name="name">Give Survey Answer</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">survey.name.wiz</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,233 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
import time
from random import choice
import string
import os
import datetime
import socket
from openerp import tools
from openerp.modules.module import get_module_resource
from openerp.osv import fields, osv
import openerp.report
from openerp.tools.translate import _
class survey_send_invitation(osv.osv_memory):
_name = 'survey.send.invitation'
_columns = {
'partner_ids': fields.many2many('res.partner','survey_res_partner','partner_id',\
'survey_id', "Answer", required=1),
'send_mail': fields.boolean('Send Mail for New User'),
'send_mail_existing': fields.boolean('Send Reminder for Existing User'),
'mail_subject': fields.char('Subject', size=256),
'mail_subject_existing': fields.char('Subject', size=256),
'mail_from': fields.char('From', size=256, required=1),
'mail': fields.text('Body')
}
_defaults = {
'send_mail': lambda *a: 1,
'send_mail_existing': lambda *a: 1,
}
def genpasswd(self):
chars = string.letters + string.digits
return ''.join([choice(chars) for i in range(6)])
def default_get(self, cr, uid, fields_list, context=None):
if context is None:
context = {}
data = super(survey_send_invitation, self).default_get(cr, uid, fields_list, context)
survey_obj = self.pool.get('survey')
msg = ""
name = ""
for sur in survey_obj.browse(cr, uid, context.get('active_ids', []), context=context):
name += "\n --> " + sur.title + "\n"
if sur.state != 'open':
msg += sur.title + "\n"
data['mail_subject'] = _("Invitation for %s") % (sur.title)
data['mail_subject_existing'] = _("Invitation for %s") % (sur.title)
data['mail_from'] = sur.responsible_id.email
if msg:
raise osv.except_osv(_('Warning!'), _('The following surveys are not in open state: %s') % msg)
data['mail'] = _('''
Hello %%(name)s, \n\n
Would you please spent some of your time to fill-in our survey: \n%s\n
You can access this survey with the following parameters:
URL: %s
Your login ID: %%(login)s\n
Your password: %%(passwd)s\n
\n\n
Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context))
return data
def create_report(self, cr, uid, res_ids, report_name=False, file_name=False):
if not report_name or not res_ids:
return (False, Exception('Report name and Resources ids are required !!!'))
try:
ret_file_name = get_module_resource('survey', 'report') + file_name + '.pdf'
result, format = openerp.report.render_report(cr, uid, res_ids, report_name[len('report.'):], {}, {})
fp = open(ret_file_name, 'wb+');
fp.write(result);
fp.close();
except Exception,e:
print 'Exception in create report:',e
return (False, str(e))
return (True, ret_file_name)
def action_send(self, cr, uid, ids, context=None):
if context is None:
context = {}
record = self.read(cr, uid, ids, [],context=context)
survey_ids = context.get('active_ids', [])
record = record and record[0]
partner_ids = record['partner_ids']
user_ref= self.pool.get('res.users')
survey_ref= self.pool.get('survey')
mail_message = self.pool.get('mail.message')
model_data_obj = self.pool.get('ir.model.data')
group_id = model_data_obj._get_id(cr, uid, 'base', 'group_survey_user')
group_id = model_data_obj.browse(cr, uid, group_id, context=context).res_id
act_id = self.pool.get('ir.actions.act_window')
act_id = act_id.search(cr, uid, [('res_model', '=' , 'survey.name.wiz'), \
('view_type', '=', 'form')])
out = "login,password\n"
skipped = 0
existing = ""
created = ""
error = ""
new_user = []
attachments = {}
current_sur = survey_ref.browse(cr, uid, context.get('active_id'), context=context)
exist_user = current_sur.invited_user_ids
if exist_user:
for use in exist_user:
new_user.append(use.id)
for id in survey_ref.browse(cr, uid, survey_ids):
result, format = openerp.report.render_report(cr, uid, [id.id], 'survey.form', {}, {})
attachments[id.title +".pdf"] = result
for partner in self.pool.get('res.partner').browse(cr, uid, partner_ids):
if not partner.email:
skipped+= 1
continue
user = user_ref.search(cr, uid, [('partner_id', "=", partner.id)])
if user:
if user[0] not in new_user:
new_user.append(user[0])
user = user_ref.browse(cr, uid, user[0])
user_ref.write(cr, uid, user.id, {'survey_id':[[6, 0, survey_ids]]})
mail = record['mail']%{'login':partner.email, 'passwd':user.password, \
'name' : partner.name}
if record['send_mail_existing']:
vals = {
'state': 'outgoing',
'subject': record['mail_subject_existing'],
'body_html': '<pre>%s</pre>' % mail,
'email_to': partner.email,
'email_from': record['mail_from'],
}
self.pool.get('mail.mail').create(cr, uid, vals, context=context)
existing+= "- %s (Login: %s, Password: %s)\n" % (user.name, partner.email, \
user.password)
continue
passwd= self.genpasswd()
out+= partner.email + ',' + passwd + '\n'
mail= record['mail'] % {'login' : partner.email, 'passwd' : passwd, 'name' : partner.name}
if record['send_mail']:
vals = {
'state': 'outgoing',
'subject': record['mail_subject'],
'body_html': '<pre>%s</pre>' % mail,
'email_to': partner.email,
'email_from': record['mail_from'],
}
if attachments:
vals['attachment_ids'] = [(0,0,{'name': a_name,
'datas_fname': a_name,
'datas': str(a_content).encode('base64')})
for a_name, a_content in attachments.items()]
ans = self.pool.get('mail.mail').create(cr, uid, vals, context=context)
if ans:
res_data = {'name': partner.name or _('Unknown'),
'login': partner.email,
'email': partner.email,
'partner_id': partner.id,
'password': passwd,
'address_id': partner.id,
'groups_id': [[6, 0, [group_id]]],
'action_id': act_id[0],
'survey_id': [[6, 0, survey_ids]]
}
create_ctx = dict(context, no_reset_password=True)
user = user_ref.create(cr, uid, res_data, context=create_ctx)
if user not in new_user:
new_user.append(user)
created+= "- %s (Login: %s, Password: %s)\n" % (partner.name or _('Unknown'),\
partner.email, passwd)
else:
error+= "- %s (Login: %s, Password: %s)\n" % (partner.name or _('Unknown'),\
partner.email, passwd)
new_vals = {}
new_vals.update({'invited_user_ids':[[6,0,new_user]]})
survey_ref.write(cr, uid, context.get('active_id'),new_vals)
note= ""
if created:
note += 'Created users:\n%s\n\n' % (created)
if existing:
note +='Already existing users:\n%s\n\n' % (existing)
if skipped:
note += "%d contacts where ignored (an email address is missing).\n\n" % (skipped)
if error:
note += 'Email not send successfully:\n====================\n%s\n' % (error)
context.update({'note' : note})
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'survey.send.invitation.log',
'type': 'ir.actions.act_window',
'target': 'new',
'context': context
}
class survey_send_invitation_log(osv.osv_memory):
_name = 'survey.send.invitation.log'
_columns = {
'note' : fields.text('Log', readonly=1)
}
def default_get(self, cr, uid, fields_list, context=None):
if context is None:
context = {}
data = super(survey_send_invitation_log, self).default_get(cr, uid, fields_list, context)
data['note'] = context.get('note', '')
return data
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,74 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!-- Survey send invitation Form View -->
<record id="view_survey_send_invitation" model="ir.ui.view">
<field name="name">Send Invitation</field>
<field name="model">survey.send.invitation</field>
<field name="arch" type="xml">
<form string="Send Invitation" version="7.0">
<group col="4">
<separator string="Select Partner" colspan="4"/>
<field name="partner_ids" nolabel="1" colspan="4" widget="many2many_tags"/>
<separator colspan="4" string="Send Mail for New User"/>
<field name="send_mail" nolabel="1"/>
<field name="mail_subject" colspan="3"/>
<separator colspan="4" string="Send Reminder for Existing User"/>
<field name="send_mail_existing" nolabel="1"/>
<field name="mail_subject_existing" colspan="3"/>
<separator colspan="4"/>
<field name="mail_from" colspan="4"/>
<separator string="Message" colspan="4"/>
<field name="mail" nolabel="1" colspan="4"/>
</group>
<footer>
<button name="action_send" string="_Send" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<!-- Survey send invitation action -->
<record id="action_view_survey_send_invitation" model="ir.actions.act_window">
<field name="name">Send Invitation</field>
<field name="res_model">survey.send.invitation</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<act_window id="action_act_view_survey_send_invitation"
key2="client_action_multi" name="Send Invitations"
res_model="survey.send.invitation" src_model="survey"
view_mode="form" target="new" view_type="form" />
<!-- Survey send invitation Display Log Form View -->
<record id="view_survey_send_invitation_log" model="ir.ui.view">
<field name="name">survey send invitation log</field>
<field name="model">survey.send.invitation.log</field>
<field name="arch" type="xml">
<form string="User creation" version="7.0">
<group string="Results :">
<field name="note"/>
</group>
</form>
</field>
</record>
<!-- Survey send invitation action -->
<record id="action_view_survey_send_invitation_log" model="ir.actions.act_window">
<field name="name">survey.send.invitation.log</field>
<field name="res_model">survey.send.invitation.log</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import survey

View File

@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -19,31 +19,23 @@
#
##############################################################################
from openerp.osv import fields, osv
from openerp.tools.translate import _
class survey_print_statistics(osv.osv_memory):
_name = 'survey.print.statistics'
_columns = {
'survey_ids': fields.many2many('survey', string="Survey", required="1"),
}
def action_next(self, cr, uid, ids, context=None):
"""
Print Survey Statistics in pdf format.
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['survey_ids'], context=context)
res = res and res[0] or {}
datas['form'] = res
datas['model'] = 'survey.print.statistics'
return {
'type': 'ir.actions.report.xml',
'report_name': 'survey.analysis',
'datas': datas,
}
{
'name': 'Survey CRM',
'version': '2.0',
'category': 'Marketing',
'complexity': 'easy',
'description': """
Survey - CRM (bridge module)
=================================================================================
This module adds a Survey mass mailing button inside the more option of lead/customers views
""",
'author': 'OpenERP SA',
'depends': ['crm', 'survey'],
'data': [
'crm_view.xml',
],
'installable': True,
'auto_install': True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Replace the default mass-mailing wizard in base with the composition wizard -->
<act_window name="Partner Survey Mailing"
res_model="survey.mail.compose.message"
src_model="crm.lead"
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
id="survey.action_partner_survey_mail_crm"
context="{
'default_use_template': True,
'default_template_id': ref('survey.email_template_survey'),
}" />
</data>
</openerp>

View File

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import osv
class survey_mail_compose_message(osv.TransientModel):
_inherit = 'survey.mail.compose.message'
def default_get(self, cr, uid, fields, context=None):
res = super(survey_mail_compose_message, self).default_get(cr, uid, fields, context=context)
if context.get('active_model') == 'crm.lead' and context.get('active_ids'):
partner_ids = []
emails_list = []
for lead in self.pool.get('crm.lead').browse(cr, uid, context.get('active_ids'), context=context):
if lead.partner_id:
partner_ids.append(lead.partner_id.id)
else:
email = lead.contact_name and "%s <%s>" % (lead.contact_name, lead.email_from or "") or lead.email_from or None
if email and email not in emails_list:
emails_list.append(email)
multi_email = "\n".join(emails_list)
res.update({'partner_ids': list(set(partner_ids)), 'multi_email': multi_email})
return res

View File

@ -56,12 +56,12 @@ openerp.web_linkedin = function(instance) {
this.linkedin_def.reject();
this.auth_def.reject();
IN = false;
instance.web.dialog($(QWeb.render("LinkedIn.DisabledWarning", {'error': error})), {
var dialog = new instance.web.Dialog(this, {
title: _t("LinkedIn is not enabled"),
buttons: [
{text: _t("Ok"), click: function() { $(this).dialog("close"); }}
]
});
{text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
],
}, QWeb.render('LinkedIn.DisabledWarning', {error: error})).open();
},
test_linkedin: function() {
var self = this;
@ -369,11 +369,11 @@ openerp.web_linkedin = function(instance) {
},
bind_event: function() {
var self = this;
this.$el.parent().on("click", ".oe_linkedin_logout", function () {
this.$el.parents('.modal').on("click", ".oe_linkedin_logout", function () {
IN.User.logout();
self.destroy();
});
this.$search = this.$el.parent().find(".oe_linkedin_advanced_search" );
this.$search = this.$el.parents('.modal').find(".oe_linkedin_advanced_search" );
this.$url = this.$search.find("input[name='search']" );
this.$button = this.$search.find("button");
@ -396,7 +396,7 @@ openerp.web_linkedin = function(instance) {
IN.API.Profile("me")
.fields(["firstName", "lastName"])
.result(function (result) {
$(QWeb.render('LinkedIn.loginInformation', result.values[0])).appendTo(self.$el.parent().find(".ui-dialog-buttonpane"));
$(QWeb.render('LinkedIn.loginInformation', result.values[0])).appendTo(self.$el.parents('.modal').find(".oe_dialog_custom_buttons"));
})
},
do_search: function(url) {

View File

@ -1,4 +1,3 @@
@charset "utf-8";
/* THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY
*
* css for editor buttons, openerp widget included in the website and other
@ -108,6 +107,10 @@ header a.navbar-brand img {
}
/* ----- Snippets Styles ----- */
.para_large {
font-size: 120%;
}
.readable {
font-size: 120%;
max-width: 700px;

View File

@ -76,6 +76,9 @@ header
/* ----- Snippets Styles ----- */
.para_large
font-size: 120%
.readable
font-size: 120%
max-width: 700px

Some files were not shown because too many files have changed in this diff Show More