partial commit
bzr revid: rim@openerp.com-20131115075150-jyabo0umip4xypks
This commit is contained in:
@@ -38,8 +38,8 @@ sent mails with user name and password for the invitation of the survey.
|
||||
'website': 'https://www.openerp.com/',
|
||||
'depends': ['email_template', 'mail', 'website'],
|
||||
'data': [
|
||||
'security/survey_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
#'security/survey_security.xml',
|
||||
#'security/ir.model.access.csv',
|
||||
'survey_view.xml',
|
||||
'views/survey_templates.xml',
|
||||
#'wizard/survey_answer.xml',
|
||||
|
||||
@@ -22,10 +22,7 @@
|
||||
from openerp.addons.web import http
|
||||
from openerp.addons.web.http import request
|
||||
from openerp.addons.website.models import website
|
||||
# from openerp.tools.translate import _
|
||||
# from openerp.tools.safe_eval import safe_eval
|
||||
|
||||
# import simplejson
|
||||
import werkzeug
|
||||
import logging
|
||||
|
||||
@@ -34,6 +31,7 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
class WebsiteSurvey(http.Controller):
|
||||
|
||||
# Survey list
|
||||
@website.route(['/survey/',
|
||||
'/survey/list/'],
|
||||
type='http', auth='public', multilang=True)
|
||||
@@ -47,6 +45,7 @@ class WebsiteSurvey(http.Controller):
|
||||
surveys = survey_obj.browse(cr, uid, survey_ids, context=context)
|
||||
return request.website.render('survey.list', {'surveys': surveys})
|
||||
|
||||
# Survey filling, validation and storage
|
||||
@website.route(['/survey/fill/<model("survey.survey"):survey>'],
|
||||
type='http', auth='public', multilang=True)
|
||||
def fill_survey(self, survey=None, **post):
|
||||
@@ -66,7 +65,7 @@ class WebsiteSurvey(http.Controller):
|
||||
|
||||
# Display success message if totally succeeded
|
||||
if post and post['next'] == "finished":
|
||||
return request.website.render('survey.finished')
|
||||
return request.website.render('survey.finished', {'survey': survey})
|
||||
|
||||
# Page selection
|
||||
pagination = {'current': -1, 'next': 0}
|
||||
@@ -87,18 +86,26 @@ class WebsiteSurvey(http.Controller):
|
||||
{'survey': survey,
|
||||
'pagination': pagination})
|
||||
|
||||
# @website.route(['/survey/validate/<model("survey.survey"):survey>'], type='json', auth='public', multilang=True):
|
||||
# return {
|
||||
# 'error' : {}
|
||||
# }
|
||||
# @website.route(['/survey/prefill/<model("survey.survey"):survey>'], type='json', auth='public', multilang=True):
|
||||
|
||||
# @website.route(['/survey/validate/<model("survey.survey"):survey>'],
|
||||
# type='json', auth='public', multilang=True)
|
||||
# def validate(self, survey=None, **post):
|
||||
# # for each {K:V} in post, check
|
||||
# _logger.debug("Incoming json data: " + post.__str__())
|
||||
# return {'valid': True, 'errors': None}
|
||||
|
||||
# @website.route(['/survey/submit/<model("survey.survey"):survey>'], type='json', auth='public', multilang=True):
|
||||
# return {
|
||||
# 'redirect' : None
|
||||
# }
|
||||
@website.route(['/survey/submit/<model("survey.survey"):survey>'],
|
||||
type='json', auth='public', multilang=True)
|
||||
def submit(self, survey=None, **post):
|
||||
_logger.debug("Incoming json data: " + post.__str__())
|
||||
|
||||
# transform post data into dictionary
|
||||
# for each {K:V} in post, check
|
||||
|
||||
return {'redirect': '/survey/'}
|
||||
|
||||
# Printing routes
|
||||
@website.route(['/survey/print/<model("survey.survey"):survey>/'],
|
||||
type='http', auth='public', multilang=True)
|
||||
def print_empty_survey(self, survey=None, **post):
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
OpenERP Survey Module Changelog
|
||||
===============================
|
||||
|
||||
|
||||
:Author: Richard Mathot (OpenERP) <rim@openerp.com>
|
||||
:Date: October 2013
|
||||
|
||||
|
||||
Preamble
|
||||
--------
|
||||
|
||||
As large parts of this module (have been||will be) rewritten, this document attemps to list all the changes that have been made to models.
|
||||
|
||||
Model changes
|
||||
-------------
|
||||
|
||||
* ``survey_type`` is removed. The field ``survey_type.name`` is replaced by
|
||||
``srvey.category`` and is not mandatory anymore.
|
||||
*
|
||||
|
||||
.. note::
|
||||
Some fields have been renamed inside models; in this case attribute ``oldname`` has always been used to ensure smooth database migration.
|
||||
|
||||
|
||||
Something not listed here?
|
||||
--------------------------
|
||||
|
||||
**Please submit a patch with missing stuff!**
|
||||
|
||||
.. warning::
|
||||
If you don't submit corrections to documentation, a giant worm could eat your house... ;-)
|
||||
@@ -1,6 +1,6 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
var the_form = $('form');
|
||||
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");
|
||||
@@ -10,12 +10,26 @@ $(document).ready(function () {
|
||||
console.log(submit_controller);
|
||||
|
||||
|
||||
// function prefill(form){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// function validate(form){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// function submit(form){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// startsWith compatibility patch with old browsers
|
||||
if (typeof String.prototype.startsWith != 'function') {
|
||||
String.prototype.startsWith = function (str){
|
||||
return this.slice(0, str.length) == str;
|
||||
};
|
||||
}
|
||||
// if (typeof String.prototype.startsWith != 'function') {
|
||||
// String.prototype.startsWith = function (str){
|
||||
// return this.slice(0, str.length) == str;
|
||||
// };
|
||||
// }
|
||||
|
||||
// function that display error messages
|
||||
var display_form_error = function (question_id, err_msg){
|
||||
@@ -32,98 +46,120 @@ $(document).ready(function () {
|
||||
// check if number of answers is ok
|
||||
// check if answer has good qualities
|
||||
|
||||
$('form').submit(
|
||||
// Handles the event when a question is focused out
|
||||
$('.question-wrapper').focusout(
|
||||
function(){
|
||||
console.debug("[survey] Submit button clicked");
|
||||
var answers = $('form').serializeArray();
|
||||
var valid = true;
|
||||
console.debug("[survey] Focus lost on question " + $(this).attr("id"));
|
||||
});
|
||||
|
||||
$('.js_errzone').html("").hide();
|
||||
// Parameters for form submission
|
||||
$('.js_surveyform').ajaxForm({
|
||||
type: 'POST',
|
||||
contentType: 'application/json', // request mimetype
|
||||
dataType: 'json', // answer expected type
|
||||
//success:
|
||||
//error:
|
||||
url: submit_controller
|
||||
});
|
||||
|
||||
$('.question-wrapper').each(
|
||||
function(){
|
||||
var qparams = jQuery.parseJSON($(this).attr('data-oe-survey-qparams'));
|
||||
var question_id = $(this).attr('id').slice(7); //all the ids of question containers start with "survey_"
|
||||
var candidate_answers = _.filter(answers, function(item){return item.name.startsWith(question_id);});
|
||||
var answer_value;
|
||||
$('.js_surveyform').submit(function(){
|
||||
$(this).ajaxSubmit();
|
||||
return false;
|
||||
});
|
||||
|
||||
if(qparams.type === 'free_text'){
|
||||
answer_value = candidate_answers[0].value.trim();
|
||||
if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
valid = false;
|
||||
display_form_error(question_id, "This question is mandatory");
|
||||
}
|
||||
// $('form').submit(
|
||||
// function(){
|
||||
// console.debug("[survey] Submit button clicked");
|
||||
// var valid = true;
|
||||
|
||||
// $('.js_errzone').html("").hide();
|
||||
|
||||
// $('.question-wrapper').each(
|
||||
// function(){
|
||||
// var qparams = jQuery.parseJSON($(this).attr('data-oe-survey-qparams'));
|
||||
// var question_id = $(this).attr('id').slice(7); //all the ids of question containers start with "survey_"
|
||||
// var candidate_answers = _.filter(answers, function(item){return item.name.startsWith(question_id);});
|
||||
// var answer_value;
|
||||
|
||||
// if(qparams.type === 'free_text'){
|
||||
// answer_value = candidate_answers[0].value.trim();
|
||||
// if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
// valid = false;
|
||||
// display_form_error(question_id, "This question is mandatory");
|
||||
// }
|
||||
|
||||
|
||||
} else if (qparams.type === 'textbox'){
|
||||
answer_value = candidate_answers[0].value.trim();
|
||||
if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
valid = false;
|
||||
display_form_error(question_id, "This question is mandatory");
|
||||
}
|
||||
// } else if (qparams.type === 'textbox'){
|
||||
// answer_value = candidate_answers[0].value.trim();
|
||||
// if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
// valid = false;
|
||||
// display_form_error(question_id, "This question is mandatory");
|
||||
// }
|
||||
|
||||
|
||||
} else if (qparams.type === 'numerical_box'){
|
||||
answer_value = candidate_answers[0].value.trim();
|
||||
if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
valid = false;
|
||||
display_form_error(question_id, "This question is mandatory");
|
||||
// } else if (qparams.type === 'numerical_box'){
|
||||
// answer_value = candidate_answers[0].value.trim();
|
||||
// if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
// valid = false;
|
||||
// display_form_error(question_id, "This question is mandatory");
|
||||
|
||||
}
|
||||
if(answer_value !== ''){
|
||||
if(_.isNaN(parseFloat(answer_value))){
|
||||
valid = false;
|
||||
display_form_error(question_id, "You must answer with a number");
|
||||
}
|
||||
}
|
||||
// }
|
||||
// if(answer_value !== ''){
|
||||
// if(_.isNaN(parseFloat(answer_value))){
|
||||
// valid = false;
|
||||
// display_form_error(question_id, "You must answer with a number");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
} else if (qparams.type === 'datetime'){
|
||||
answer_value = candidate_answers[0].value.trim();
|
||||
if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
valid = false;
|
||||
display_form_error(question_id, "This question is mandatory");
|
||||
}
|
||||
if(answer_value !== ''){
|
||||
console.warning("Date format validation is not yet implemented");
|
||||
}
|
||||
// } else if (qparams.type === 'datetime'){
|
||||
// answer_value = candidate_answers[0].value.trim();
|
||||
// if(qparams.constr_mandatory === true && answer_value === ''){
|
||||
// valid = false;
|
||||
// display_form_error(question_id, "This question is mandatory");
|
||||
// }
|
||||
// if(answer_value !== ''){
|
||||
// console.warning("Date format validation is not yet implemented");
|
||||
// }
|
||||
|
||||
} else if (qparams.type === 'simple_choice_scale' || qparams.type === 'simple_choice_dropdown'){
|
||||
if(qparams.constr_mandatory === true && _.size(candidate_answers) === 0){
|
||||
valid = false;
|
||||
display_form_error(question_id, "This question is mandatory");
|
||||
}
|
||||
// if answers:
|
||||
// answer_value = candidate_answers[0].value;
|
||||
// } else if (qparams.type === 'simple_choice_scale' || qparams.type === 'simple_choice_dropdown'){
|
||||
// if(qparams.constr_mandatory === true && _.size(candidate_answers) === 0){
|
||||
// valid = false;
|
||||
// display_form_error(question_id, "This question is mandatory");
|
||||
// }
|
||||
// // if answers:
|
||||
// // answer_value = candidate_answers[0].value;
|
||||
|
||||
|
||||
|
||||
} else if (qparams.type === 'multiple_choice'){
|
||||
var answ_nbr = _.size(candidate_answers);
|
||||
if(qparams.constr_mandatory === true && answ_nbr <= 0){
|
||||
valid = false;
|
||||
display_form_error(question_id, "This question is mandatory");
|
||||
}
|
||||
// } else if (qparams.type === 'multiple_choice'){
|
||||
// var answ_nbr = _.size(candidate_answers);
|
||||
// if(qparams.constr_mandatory === true && answ_nbr <= 0){
|
||||
// valid = false;
|
||||
// display_form_error(question_id, "This question is mandatory");
|
||||
// }
|
||||
|
||||
|
||||
// } else if (qparams.type === 'vector'){
|
||||
// // } else if (qparams.type === 'vector'){
|
||||
|
||||
|
||||
|
||||
// } else if (qparams.type === 'matrix'){
|
||||
// // } else if (qparams.type === 'matrix'){
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
console.warning('Not supported question type!');
|
||||
}
|
||||
// } else {
|
||||
// console.warning('Not supported question type!');
|
||||
// }
|
||||
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
return valid;
|
||||
// return valid;
|
||||
|
||||
// // _.filter(answers, function(item){return item.name.startsWith(question_id);})
|
||||
// return;
|
||||
// });
|
||||
|
||||
// _.filter(answers, function(item){return item.name.startsWith(question_id);})
|
||||
});
|
||||
|
||||
});
|
||||
+20
-13
@@ -91,8 +91,7 @@ class survey_survey(osv.osv):
|
||||
'date_open': fields.datetime('Opening date'),
|
||||
'date_close': fields.datetime('Closing date'),
|
||||
'user_input_limit': fields.integer('Automatic closing limit',
|
||||
help="Limits the number of instances of this survey that can be \
|
||||
completed (if set to 0, no limit is applied",
|
||||
help="Limits the number of instances of this survey that can be completed (if set to 0, no limit is applied",
|
||||
oldname='max_response_limit'),
|
||||
'state': fields.selection(
|
||||
[('draft', 'Draft'), ('open', 'Open'), ('close', 'Closed'),
|
||||
@@ -106,8 +105,8 @@ class survey_survey(osv.osv):
|
||||
string="Number of started surveys", type="integer"),
|
||||
'tot_comp_survey': fields.function(_get_tot_comp_survey,
|
||||
string="Number of completed surveys", type="integer"),
|
||||
'description': fields.text('Description', size=128, translate=True,
|
||||
oldname="description"),
|
||||
'description': fields.html('Description', translate=True,
|
||||
oldname="description", help="A long description of the purpose of the survey"),
|
||||
'color': fields.integer('Color Index'),
|
||||
'user_input_ids': fields.one2many('survey.user_input', 'survey_id',
|
||||
'User responses', readonly=1,),
|
||||
@@ -115,9 +114,11 @@ class survey_survey(osv.osv):
|
||||
string="Public link", searchable=True, type="char"), # store=True),
|
||||
'email_template_id': fields.many2one('email.template',
|
||||
'Email Template', ondelete='set null'),
|
||||
'thank_you_message': fields.html('Thank you message', translate=True,
|
||||
help="This message will be displayed when survey is completed")
|
||||
}
|
||||
_defaults = {
|
||||
'category': 'Uncategorized',
|
||||
'category': lambda x: _('Uncategorized'),
|
||||
'user_input_limit': 0,
|
||||
'state': 'draft',
|
||||
'visible_to_user': True,
|
||||
@@ -279,11 +280,15 @@ class survey_page(osv.osv):
|
||||
'question_ids': fields.one2many('survey.question', 'page_id',
|
||||
'Questions'),
|
||||
'sequence': fields.integer('Page number'),
|
||||
'description': fields.text('Description',
|
||||
'description': fields.html('Description',
|
||||
help="An introductory text to your page", translate=True,
|
||||
oldname="note"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'sequence': 1
|
||||
}
|
||||
|
||||
# Public methods #
|
||||
|
||||
def survey_save(self, cr, uid, ids, context=None):
|
||||
@@ -335,7 +340,7 @@ class survey_question(osv.osv):
|
||||
|
||||
# Question
|
||||
'question': fields.char('Question', required=1, translate=True),
|
||||
'description': fields.text('Description', help="Use this field to add \
|
||||
'description': fields.char('Description', help="Use this field to add \
|
||||
additional explanations about your question", translate=True,
|
||||
oldname='descriptive_text'),
|
||||
|
||||
@@ -347,9 +352,7 @@ class survey_question(osv.osv):
|
||||
('simple_choice_scale', 'One choice on a scale'),
|
||||
('simple_choice_dropdown', 'One choice in a menu'),
|
||||
('multiple_choice', 'Some choices in checkboxes'),
|
||||
('vector', 'Multi-questions'),
|
||||
('matrix', 'Matrix')
|
||||
], 'Question Type', required=1),
|
||||
('matrix', 'Matrix')], 'Question Type', required=1),
|
||||
'suggested_answers_ids': fields.one2many('survey.suggestion',
|
||||
'question_id', 'Suggested answers', oldname='answer_choice_ids'),
|
||||
|
||||
@@ -368,10 +371,11 @@ class survey_question(osv.osv):
|
||||
('has_length', 'Must have a specific length'),
|
||||
('is_integer', 'Must be an integer'),
|
||||
('is_decimal', 'Must be a decimal number'),
|
||||
#('is_date', 'Must be a date'),
|
||||
('is_date', 'Must be a date'),
|
||||
('is_email', 'Must be an email address')
|
||||
], 'Validation type'),
|
||||
'validation_length': fields.integer('Specific length'),
|
||||
'validation_length_min': fields.integer('Minimum length'),
|
||||
'validation_length_max': fields.integer('Maximum length'),
|
||||
'validation_min_float_value': fields.float('Minimum value'),
|
||||
'validation_max_float_value': fields.float('Maximum value'),
|
||||
'validation_min_int_value': fields.integer('Minimum value'),
|
||||
@@ -399,15 +403,18 @@ class survey_question(osv.osv):
|
||||
}
|
||||
_defaults = {
|
||||
'page_id': lambda s, cr, uid, c: c.get('page_id'),
|
||||
'sequence': 1,
|
||||
'type': 'free_text',
|
||||
|
||||
'validation_error_msg': lambda s, cr, uid, c: _('The answer you entered has an invalid format.'),
|
||||
'constr_type': 'at least',
|
||||
'constr_minimum_req_ans': 1,
|
||||
'constr_error_msg': lambda s, cr, uid, c:
|
||||
_('This question requires an answer.'),
|
||||
'validation_required': 'False',
|
||||
'validation_length_min': 0,
|
||||
'validation_length_max': 5000,
|
||||
}
|
||||
_sql_constraints = [('validation_length', 'CHECK (validation_length_min <= validation_length_max)', 'Max length cannot be smaller than min length!')]
|
||||
|
||||
def on_change_page_id(self, cr, uid, ids, page_id, context=None):
|
||||
if page_id:
|
||||
|
||||
+301
-302
@@ -19,93 +19,89 @@
|
||||
<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>
|
||||
<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">
|
||||
<header>
|
||||
<button name="action_cancel" states="new,skip" string="Cancel" type="object" icon="gtk-stop"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box" name="button_box">
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/><br/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</div>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="survey_id"/>
|
||||
<field name="date_create"/>
|
||||
<field name="deadline"/>
|
||||
<field name="type"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="partner_id"/>
|
||||
<field name="email"/>
|
||||
<field name="token" groups="base.group_no_one"/>
|
||||
</group>
|
||||
<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">
|
||||
<header>
|
||||
<button name="action_cancel" states="new,skip" string="Cancel" type="object" icon="gtk-stop"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box" name="button_box">
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/><br/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</div>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="survey_id"/>
|
||||
<field name="date_create"/>
|
||||
<field name="deadline"/>
|
||||
<field name="type"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<group>
|
||||
<field name="partner_id"/>
|
||||
<field name="email"/>
|
||||
<field name="token" groups="base.group_no_one"/>
|
||||
</group>
|
||||
</group>
|
||||
</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">
|
||||
<field name="survey_id"/>
|
||||
<field name="date_create"/>
|
||||
<field name="deadline"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="email"/>
|
||||
<field name="type"/>
|
||||
<field name="state"/>
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</tree>
|
||||
</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">
|
||||
<field name="survey_id"/>
|
||||
<field name="date_create"/>
|
||||
<field name="deadline"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="email"/>
|
||||
<field name="type"/>
|
||||
<field name="state"/>
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_survey_user_input">
|
||||
<field name="name">Survey Response</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 model="ir.actions.act_window" id="action_survey_user_input">
|
||||
<field name="name">Survey Response</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>
|
||||
<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>
|
||||
|
||||
|
||||
<!--
|
||||
@@ -118,7 +114,7 @@
|
||||
<field name="priority">1</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Survey" version="7.0">
|
||||
<header groups="base.group_survey_manager">
|
||||
<header groups="base.group_survey_manager">
|
||||
<!-- <button name="action_edit_survey" states="draft" string="Edit Survey" type="object" class="oe_highlight"/>
|
||||
<button name="survey_cancel" string="Cancel" states="draft" type="object"/>
|
||||
<button name="action_send_survey" string="Invite people" states="open" type="object" class="oe_highlight"/> -->
|
||||
@@ -135,49 +131,49 @@
|
||||
<field name="title" attrs="{'readonly':[('state','in',['close','cancel'])]}"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group colspan="4">
|
||||
<field name="category" attrs="{'readonly':[('state','in',['close','cancel'])]}"/>
|
||||
<field name="user_input_limit" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
<field name="visible_to_user"/>
|
||||
<field name="public_url" widget="url"/>
|
||||
<field name="auth_required" />
|
||||
<field name="date_open" />
|
||||
<field name="date_close" />
|
||||
</group>
|
||||
<field name="description" attrs="{'readonly': True}"/>
|
||||
<group string="Pages">
|
||||
<field name="page_ids" colspan="4" mode="tree" attrs="{'readonly':[('state','=','close')]}" context="{'default_survey_id': active_id}" nolabel="1">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="title"/>
|
||||
<field name="question_ids"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<field name="page_ids" colspan="4" mode="tree" attrs="{'readonly':[('state','=','close')]}" context="{'default_survey_id': active_id}">
|
||||
<tree string="Survey Question">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="title"/>
|
||||
<field name="question_ids"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="description" placeholder="Survey description..." attrs="{'readonly':[('state','=','close')]}"/>
|
||||
<group string="Survey options">
|
||||
<field name="category" attrs="{'readonly':[('state','in',['close','cancel'])]}"/>
|
||||
<field name="user_input_limit" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
<field name="visible_to_user"/>
|
||||
<field name="auth_required" />
|
||||
<field name="public_url" widget="url"/>
|
||||
</group>
|
||||
<label for="thank_you_message" class="oe_edit_only"/>
|
||||
<field name="thank_you_message" attrs="{'readonly': True}"/>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers"/>
|
||||
<field name="message_ids" widget="mail_thread"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id= "survey_tree">
|
||||
<field name="name">survey_tree</field>
|
||||
<field name="model">survey.survey</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="gray:state == 'close'" string="Survey">
|
||||
<field name="title" />
|
||||
<field name="category"/>
|
||||
<field name="date_open" string="Opening date" />
|
||||
<field name="date_close" string="Closing date" />
|
||||
<field name="state" />
|
||||
<field name="tot_start_survey" string="Started" />
|
||||
<field name="tot_comp_survey" string="Completed" />
|
||||
<field name="user_input_limit" string="Max closing limit" />
|
||||
<button name="action_fill_survey" states="open"
|
||||
string="Fill in Survey" type="object" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
|
||||
<record model="ir.ui.view" id= "survey_tree">
|
||||
<field name="name">survey_tree</field>
|
||||
<field name="model">survey.survey</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="gray:state == 'close'" string="Survey">
|
||||
<field name="title" />
|
||||
<field name="category"/>
|
||||
<field name="date_open" string="Opening date" />
|
||||
<field name="date_close" string="Closing date" />
|
||||
<field name="state" />
|
||||
<field name="tot_start_survey" string="Started" />
|
||||
<field name="tot_comp_survey" string="Completed" />
|
||||
<field name="user_input_limit" string="Max closing limit" />
|
||||
<button name="action_fill_survey" states="open"
|
||||
string="Fill in Survey" type="object" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
|
||||
<button name="action_print_survey" string="Print Answer" type="object" icon="gtk-print"/>
|
||||
<button name="print_statistics" string="Print Statistics" states="open,close,cancel" type="object" icon="gtk-print" groups="base.group_survey_manager"/>
|
||||
|
||||
@@ -198,105 +194,105 @@
|
||||
<filter string="Cancelled" domain="[('state','=','cancel')]"/>
|
||||
<separator/>
|
||||
<filter string="Not completed yet" name="unread_message" domain="['&', ('response_ids.state', 'in', ['new', 'skip']), ('response_ids.partner_id.user_id', '=', uid)]"/>
|
||||
<group expand="1" string="Group by...">
|
||||
<filter string="Category" name="group_category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'category'}"/>
|
||||
<filter string="Status" name="group_status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<group expand="1" string="Group by...">
|
||||
<filter string="Category" name="group_category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'category'}"/>
|
||||
<filter string="Status" name="group_status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_survey_kanban">
|
||||
<field name="name">event.survey.kanban</field>
|
||||
<field name="model">survey.survey</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban>
|
||||
<field name="title"/>
|
||||
<field name="date_open"/>
|
||||
<field name="tot_comp_survey"/>
|
||||
<field name="user_input_limit"/>
|
||||
<field name="color"/>
|
||||
<field name="state"/>
|
||||
<field name="auth_required"/>
|
||||
<field name="public_url"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_survey oe_kanban_global_click">
|
||||
<span class="oe_survey_fill">
|
||||
<t t-if="record.state.raw_value === 'open'"><a name="action_fill_survey" type="object">Fill in Survey</a></t>
|
||||
<t t-if="record.state.raw_value !== 'open'"><a name="action_edit_survey" type="object">Test Survey</a></t>
|
||||
</span>
|
||||
<div class="oe_dropdown_toggle oe_dropdown_kanban" t-if="widget.view.is_action_enabled('edit')">
|
||||
<span class="oe_e">i</span>
|
||||
<ul class="oe_dropdown_menu">
|
||||
<t t-if="widget.view.is_action_enabled('edit')"><li><a type="open">Survey Settings...</a></li></t>
|
||||
<t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
|
||||
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="oe_kanban_content">
|
||||
<span class="oe_kanban_right" t-if="widget.view.is_action_enabled('edit')">
|
||||
<a t-if="record.state.raw_value === 'draft'" title="Draft" class="oe_kanban_status"> </a>
|
||||
<a t-if="record.state.raw_value === 'open' and record.auth_required.raw_value" title="Open for authentified people" class="oe_kanban_status_green"> </a>
|
||||
<a t-if="record.state.raw_value === 'open' and !record.auth_required.raw_value" title="Open to everyone" class="oe_kanban_status_green"> </a>
|
||||
<a t-if="record.state.raw_value === 'close'" title="Close" class="oe_kanban_status_red"> </a>
|
||||
<a t-if="record.state.raw_value === 'cancel'" title="Cancelled" class="oe_kanban_status_red"> </a>
|
||||
</span>
|
||||
<h3 class="oe_kanban_ellipsis"><t t-esc="record.title.raw_value.toString()"></t></h3>
|
||||
<table class="oe_kanban_survey_list" t-if="widget.view.is_action_enabled('edit')">
|
||||
<tr>
|
||||
<td>
|
||||
<t t-if="record.state.raw_value === 'open'"><a name="action_survey_fill2" type="object">Take survey</a></t>
|
||||
<t t-if="record.state.raw_value !== 'open'"><span class="oe_inactive" title="You can only take open surveys">Take survey</span></t>
|
||||
</td>
|
||||
<td>
|
||||
<t t-if="record.state.raw_value === 'open'"><a name="action_send_survey" type="object">Invite people</a></t>
|
||||
<t t-if="record.state.raw_value !== 'open'"><span class="oe_inactive" title="You can only collect answers for the open survey">Invite people</span></t>
|
||||
</td>
|
||||
<td>
|
||||
<t t-if="record.tot_comp_survey.raw_value"><a name="%(action_selected_survey_user_input)d" type="action">Get responses (<field name="tot_comp_survey"/><t t-if="record.user_input_limit.raw_value > 0"> / <field name="user_input_limit"/></t>)</a></t>
|
||||
<t t-if="!record.tot_comp_survey.raw_value"><span class="oe_inactive" title="There is no answer yet">Get responses (<field name="tot_comp_survey"/><t t-if="record.user_input_limit.raw_value > 0"> / <field name="user_input_limit"/></t>)</span></t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a name="action_print_survey" type="object">Print Survey</a>
|
||||
</td>
|
||||
<td>
|
||||
<t t-if="record.tot_comp_survey.raw_value"><a name="print_statistics" type="object">Print Statistics</a></t>
|
||||
<t t-if="!record.tot_comp_survey.raw_value"><span class="oe_inactive" title="There is no answer yet">Print Statistics</span></t>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<record model="ir.ui.view" id="view_survey_kanban">
|
||||
<field name="name">event.survey.kanban</field>
|
||||
<field name="model">survey.survey</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban>
|
||||
<field name="title"/>
|
||||
<field name="date_open"/>
|
||||
<field name="tot_comp_survey"/>
|
||||
<field name="user_input_limit"/>
|
||||
<field name="color"/>
|
||||
<field name="state"/>
|
||||
<field name="auth_required"/>
|
||||
<field name="public_url"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_survey oe_kanban_global_click">
|
||||
<span class="oe_survey_fill">
|
||||
<t t-if="record.state.raw_value === 'open'"><a name="action_fill_survey" type="object">Fill in Survey</a></t>
|
||||
<t t-if="record.state.raw_value !== 'open'"><a name="action_edit_survey" type="object">Test Survey</a></t>
|
||||
</span>
|
||||
<div class="oe_dropdown_toggle oe_dropdown_kanban" t-if="widget.view.is_action_enabled('edit')">
|
||||
<span class="oe_e">i</span>
|
||||
<ul class="oe_dropdown_menu">
|
||||
<t t-if="widget.view.is_action_enabled('edit')"><li><a type="open">Survey Settings...</a></li></t>
|
||||
<t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
|
||||
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
|
||||
</ul>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
<div class="oe_kanban_content">
|
||||
<span class="oe_kanban_right" t-if="widget.view.is_action_enabled('edit')">
|
||||
<a t-if="record.state.raw_value === 'draft'" title="Draft" class="oe_kanban_status"> </a>
|
||||
<a t-if="record.state.raw_value === 'open' and record.auth_required.raw_value" title="Open for authentified people" class="oe_kanban_status_green"> </a>
|
||||
<a t-if="record.state.raw_value === 'open' and !record.auth_required.raw_value" title="Open to everyone" class="oe_kanban_status_green"> </a>
|
||||
<a t-if="record.state.raw_value === 'close'" title="Close" class="oe_kanban_status_red"> </a>
|
||||
<a t-if="record.state.raw_value === 'cancel'" title="Cancelled" class="oe_kanban_status_red"> </a>
|
||||
</span>
|
||||
<h3 class="oe_kanban_ellipsis"><t t-esc="record.title.raw_value.toString()"></t></h3>
|
||||
<table class="oe_kanban_survey_list" t-if="widget.view.is_action_enabled('edit')">
|
||||
<tr>
|
||||
<td>
|
||||
<t t-if="record.state.raw_value === 'open'"><a name="action_survey_fill2" type="object">Take survey</a></t>
|
||||
<t t-if="record.state.raw_value !== 'open'"><span class="oe_inactive" title="You can only take open surveys">Take survey</span></t>
|
||||
</td>
|
||||
<td>
|
||||
<t t-if="record.state.raw_value === 'open'"><a name="action_send_survey" type="object">Invite people</a></t>
|
||||
<t t-if="record.state.raw_value !== 'open'"><span class="oe_inactive" title="You can only collect answers for the open survey">Invite people</span></t>
|
||||
</td>
|
||||
<td>
|
||||
<t t-if="record.tot_comp_survey.raw_value"><a name="%(action_selected_survey_user_input)d" type="action">Get responses (<field name="tot_comp_survey"/><t t-if="record.user_input_limit.raw_value > 0"> / <field name="user_input_limit"/></t>)</a></t>
|
||||
<t t-if="!record.tot_comp_survey.raw_value"><span class="oe_inactive" title="There is no answer yet">Get responses (<field name="tot_comp_survey"/><t t-if="record.user_input_limit.raw_value > 0"> / <field name="user_input_limit"/></t>)</span></t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a name="action_print_survey" type="object">Print Survey</a>
|
||||
</td>
|
||||
<td>
|
||||
<t t-if="record.tot_comp_survey.raw_value"><a name="print_statistics" type="object">Print Statistics</a></t>
|
||||
<t t-if="!record.tot_comp_survey.raw_value"><span class="oe_inactive" title="There is no answer yet">Print Statistics</span></t>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</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="view_id" ref="view_survey_kanban"></field>
|
||||
<field name="search_view_id" ref="survey_search"/>
|
||||
<field name="context">{'search_default_group_category': 1}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new survey.
|
||||
</p><p>
|
||||
You can create survey for different purposes: recruitment
|
||||
interviews, employee's periodical evaluations, marketing
|
||||
campaigns, etc.
|
||||
</p><p>
|
||||
A survey is made of pages containing questions
|
||||
of several types: text, multiple choices, etc.
|
||||
</p>
|
||||
</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="view_id" ref="view_survey_kanban"></field>
|
||||
<field name="search_view_id" ref="survey_search"/>
|
||||
<field name="context">{'search_default_group_category': 1}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new survey.
|
||||
</p><p>
|
||||
You can create survey for different purposes: recruitment
|
||||
interviews, employee's periodical evaluations, marketing
|
||||
campaigns, etc.
|
||||
</p><p>
|
||||
A survey is made of pages containing questions
|
||||
of several types: text, multiple choices, etc.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Survey Pages
|
||||
@@ -308,20 +304,21 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Survey Page" version="7.0">
|
||||
<sheet class="oe_survey">
|
||||
<group col="2" invisible="context.get('edit')" attrs="{'invisible': [('survey_id','!=',None)]}">
|
||||
<group invisible="context.get('edit')" attrs="{'invisible': [('survey_id','!=',None)]}">
|
||||
<field name="survey_id"/>
|
||||
</group>
|
||||
<label for="title" class="oe_edit_only"/>
|
||||
<h1>
|
||||
<field name="title"/>
|
||||
</h1>
|
||||
<group colspan="4" col="1">
|
||||
<field name="description" nolabel="1" placeholder="Description on the survey page..."/>
|
||||
<div class="oe_title">
|
||||
<label for="title" class="oe_edit_only"/>
|
||||
<h1><field name="title"/></h1>
|
||||
</div>
|
||||
<field name="description" attrs="{'readonly': True}"/>
|
||||
<group string="Questions">
|
||||
<field name="question_ids" nolabel="1" mode="tree" context="{'default_page_id': active_id}">
|
||||
<tree string="Survey Question">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="question"/>
|
||||
<field name="type"/>
|
||||
<field name="constr_mandatory"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
@@ -378,13 +375,13 @@
|
||||
<field name="title" colspan="4"/>
|
||||
<separator string="Description" colspan="4"/>
|
||||
<field name="note" colspan="4" nolabel="1"/>
|
||||
<group colspan="4">
|
||||
<label string="" colspan="3"/>
|
||||
<button name="survey_save" string="Ok" type="object" icon="gtk-go-forward"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<group colspan="4">
|
||||
<label string="" colspan="3"/>
|
||||
<button name="survey_save" string="Ok" type="object" icon="gtk-go-forward"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Survey Question
|
||||
@@ -412,7 +409,7 @@
|
||||
<tree string="Suggested answers" editable="bottom">
|
||||
<field name="value" />
|
||||
</tree>
|
||||
</field>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<!-- Sub-questions -->
|
||||
@@ -420,24 +417,19 @@
|
||||
<field name='children_ids' nolabel='1' context="{'default_parent_id': active_id}"/>
|
||||
</group>
|
||||
|
||||
<!-- Comments -->
|
||||
<group colspan="1" string="Comments" attrs="{'invisible':[('type','in',['freetext'])]}">
|
||||
<field name='comments_allowed' />
|
||||
<group colspan="2" attrs="{'invisible':[('comments_allowed','=',False)]}">
|
||||
<field name='comment_count_as_answer' />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- Question validation -->
|
||||
<group colspan="1" string="Question required">
|
||||
<group colspan="2" string="Question required">
|
||||
<field name="constr_mandatory" string="Is this question mandatory?"/>
|
||||
<group colspan="2" attrs="{'invisible':[('constr_mandatory','=',False)]}">
|
||||
<field name="constr_type" string="Users must answer..."/>
|
||||
<group colspan="2" attrs="{'invisible':[('constr_type','not in',['at least','a range'])]}">
|
||||
<field name="constr_minimum_req_ans" nolabel="1" />
|
||||
</group>
|
||||
<group colspan="2" attrs="{'invisible':[('constr_type','not in',['at most','a range', 'exactly'])]}">
|
||||
<field name="constr_maximum_req_ans" nolabel="1" />
|
||||
<group attrs="{'invisible':[('constr_mandatory','=',False)]}">
|
||||
<group attrs="{'invisible':[('type','not in',['numerical_box'])]}">
|
||||
<field name="constr_type" string="Users must answer..."/>
|
||||
<group attrs="{'invisible':[('constr_type','not in',['at least','a range'])]}">
|
||||
<field name="constr_minimum_req_ans" nolabel="1" />
|
||||
</group>
|
||||
<group attrs="{'invisible':[('constr_type','not in',['at most','a range', 'exactly'])]}">
|
||||
<field name="constr_maximum_req_ans" nolabel="1" />
|
||||
</group>
|
||||
</group>
|
||||
<field name="constr_error_msg" string="Error message"/>
|
||||
</group>
|
||||
@@ -451,7 +443,8 @@
|
||||
<group colspan="2" attrs="{'invisible':[('validation_required','=',False)]}">
|
||||
<field name="validation_type" />
|
||||
<group colspan="2" attrs="{'invisible':[('validation_type','!=','has_length')]}">
|
||||
<field name="validation_length" string="Length"/>
|
||||
<field name="validation_length_min" string="between"/>
|
||||
<field name="validation_length_max" string="and"/>
|
||||
</group>
|
||||
<group colspan="2" attrs="{'invisible':[('validation_type','!=','is_decimal')]}">
|
||||
<field name="validation_min_float_value" string="between"/>
|
||||
@@ -461,16 +454,22 @@
|
||||
<field name="validation_min_int_value" string="between"/>
|
||||
<field name="validation_max_int_value" string="and"/>
|
||||
</group>
|
||||
<!-- <group colspan="2" attrs="{'invisible':[('validation_type','!=','is_date')]}">
|
||||
<group colspan="2" attrs="{'invisible':[('validation_type','!=','is_date')]}">
|
||||
<field name="validation_min_date" string="between"/>
|
||||
<field name="validation_max_date" string="and"/>
|
||||
</group> -->
|
||||
</group>
|
||||
<field name="validation_error_msg" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
||||
<!-- Comments -->
|
||||
<group colspan="2" string="Comments" attrs="{'invisible':[('type','in',['free_text','textbox'])]}">
|
||||
<field name='comments_allowed' />
|
||||
<group attrs="{'invisible':[('comments_allowed','=',False)]}">
|
||||
<field name='comment_count_as_answer' />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
</sheet>
|
||||
@@ -505,7 +504,7 @@
|
||||
<filter name="group_by_survey" string="Survey" domain="[]" context="{'group_by':'survey_id'}"/>
|
||||
<filter name="group_by_page" string="Page" domain="[]" context="{'group_by':'page_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -526,10 +525,10 @@
|
||||
<field name="view_mode">tree,form</field>
|
||||
<!--<field name="view_id" ref="survey_question_tree"></field>
|
||||
<field name="search_view_id" ref="survey_question_search"/>
|
||||
<field name="context">{'search_default_group_by_survey': True, 'search_default_group_by_page': True}</field> -->
|
||||
</record>
|
||||
<field name="context">{'search_default_group_by_survey': True, 'search_default_group_by_page': True}</field> -->
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="survey_question_wizard_test">
|
||||
<record model="ir.ui.view" id="survey_question_wizard_test">
|
||||
<field name="name">survey_question_wizard_test</field>
|
||||
<field name="model">survey.question</field>
|
||||
<field name="priority">20</field>
|
||||
@@ -558,7 +557,7 @@
|
||||
<form string="Survey Answer">
|
||||
<field name="answer" colspan="4"/>
|
||||
<field name="in_visible_answer_type" invisible="1"/>
|
||||
<group colspan="4" attrs="{'invisible':[('in_visible_answer_type','=',True)]}">
|
||||
<group colspan="4" attrs="{'invisible':[('in_visible_answer_type','=',True)]}">
|
||||
<field name="type" colspan="2"/>
|
||||
<group colspan="4" attrs="{'invisible':[('type','not in',['selection'])]}">
|
||||
<separator string="Menu Choices (each choice on separate by lines)" colspan="4"/>
|
||||
@@ -650,69 +649,69 @@
|
||||
res_model="survey.page"
|
||||
src_model="survey.survey"/>
|
||||
|
||||
<act_window
|
||||
context="{'search_default_survey': active_id, 'default_survey': active_id}"
|
||||
id="act_survey_question"
|
||||
name="Questions"
|
||||
res_model="survey.question"
|
||||
src_model="survey.survey"/>
|
||||
<act_window
|
||||
context="{'search_default_survey': active_id, 'default_survey': active_id}"
|
||||
id="act_survey_question"
|
||||
name="Questions"
|
||||
res_model="survey.question"
|
||||
src_model="survey.survey"/>
|
||||
|
||||
<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"/>
|
||||
<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"/>
|
||||
|
||||
<act_window domain="[('question_id', '=', active_id)]"
|
||||
id="act_survey_answer"
|
||||
name="Answers"
|
||||
res_model="survey.suggestion"
|
||||
src_model="survey.question"/>
|
||||
<act_window domain="[('question_id', '=', active_id)]"
|
||||
id="act_survey_answer"
|
||||
name="Answers"
|
||||
res_model="survey.suggestion"
|
||||
src_model="survey.question"/>
|
||||
|
||||
<!--
|
||||
|
||||
MENU ELEMENTS
|
||||
|
||||
-->
|
||||
-->
|
||||
|
||||
<!-- Top menubar item -->
|
||||
<menuitem name="Surveys" id="survey_main" sequence="120"/>
|
||||
<!-- Top menubar item -->
|
||||
<menuitem name="Surveys" id="survey_main" sequence="120"/>
|
||||
|
||||
<!-- Left menu categories-->
|
||||
<menuitem name="Surveys" id="menu_surveys" parent="survey_main" sequence="10" groups="base.group_survey_user"/>
|
||||
<menuitem name="Statistics" id="menu_statistics" parent="survey_main" sequence="20" groups="base.group_survey_manager"/>
|
||||
<menuitem name="Configuration" id="menu_surveys_configuration" parent="survey_main" sequence="30" groups="base.group_survey_manager"/>
|
||||
<!-- Left menu categories-->
|
||||
<menuitem name="Surveys" id="menu_surveys" parent="survey_main" sequence="10" groups="base.group_survey_user"/>
|
||||
<menuitem name="Statistics" id="menu_statistics" parent="survey_main" sequence="20" groups="base.group_survey_manager"/>
|
||||
<menuitem name="Configuration" id="menu_surveys_configuration" parent="survey_main" sequence="30" groups="base.group_survey_manager"/>
|
||||
|
||||
<!-- Left menu elements: Survey -->
|
||||
<menuitem name="Surveys" id="menu_survey_form"
|
||||
action="action_survey_form" parent="menu_surveys"
|
||||
sequence="1"/>
|
||||
<!-- Left menu elements: Survey -->
|
||||
<menuitem name="Surveys" id="menu_survey_form"
|
||||
action="action_survey_form" parent="menu_surveys"
|
||||
sequence="1"/>
|
||||
|
||||
<!-- Left menu elements: Statistics -->
|
||||
<menuitem name="Surveys User inputs" id="menu_survey_type_form1"
|
||||
action="action_survey_user_input" parent="menu_statistics"
|
||||
sequence="1"/>
|
||||
|
||||
<!-- Left menu elements: Configuration -->
|
||||
<menuitem name="Survey Pages" id="menu_survey_page_form1"
|
||||
action="action_survey_page_form" parent="menu_surveys_configuration"
|
||||
sequence="1"/>
|
||||
<!-- Left menu elements: Configuration -->
|
||||
<menuitem name="Survey Pages" id="menu_survey_page_form1"
|
||||
action="action_survey_page_form" parent="menu_surveys_configuration"
|
||||
sequence="1"/>
|
||||
|
||||
<menuitem name="Survey Questions" id="menu_survey_question_form1"
|
||||
action="action_survey_question_form" parent="menu_surveys_configuration"
|
||||
sequence="2"/>
|
||||
<menuitem name="Survey Questions" id="menu_survey_question_form1"
|
||||
action="action_survey_question_form" parent="menu_surveys_configuration"
|
||||
sequence="2"/>
|
||||
|
||||
<menuitem name="Survey Suggestions" id="menu_survey_suggestion_form1"
|
||||
action="action_survey_suggestion_form" parent="menu_surveys_configuration"
|
||||
sequence="3"/>
|
||||
<menuitem name="Survey Suggestions" id="menu_survey_suggestion_form1"
|
||||
action="action_survey_suggestion_form" parent="menu_surveys_configuration"
|
||||
sequence="3"/>
|
||||
|
||||
<!-- web -->
|
||||
<record id="action_survey_fill2" model="ir.actions.client">
|
||||
<field name="res_model">survey.survey</field>
|
||||
<field name="tag">survey.fill2</field>
|
||||
</record>
|
||||
<menuitem id="menu_survey_fill2" name="Survey Fill" parent="menu_surveys"
|
||||
action="action_survey_fill2"/>
|
||||
</data>
|
||||
</openerp>
|
||||
<!-- web -->
|
||||
<record id="action_survey_fill2" model="ir.actions.client">
|
||||
<field name="res_model">survey.survey</field>
|
||||
<field name="tag">survey.fill2</field>
|
||||
</record>
|
||||
<menuitem id="menu_survey_fill2" name="Survey Fill" parent="menu_surveys"
|
||||
action="action_survey_fill2"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
<h1>Open surveys</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<tr><th>Title</th><th>Category</th><th>Description</th><th>Public URL</th></tr>
|
||||
<tr><th>Title</th><th>Description</th><th>Category</th></tr>
|
||||
<t t-foreach="surveys" t-as="survey">
|
||||
<tr>
|
||||
<td><span t-field="survey.title" /></td>
|
||||
<td><a t-att-href="survey.public_url"><span t-field="survey.title" /></a></td>
|
||||
<td><t t-if="survey.description"><span t-field="survey.description"/></t></td>
|
||||
<td><span t-field="survey.category"/></td>
|
||||
<td><t t-if="survey.description is not False"><span t-field="survey.description"/></t></td>
|
||||
<td><a t-att-href="survey.public_url"><t t-esc="survey.id" /></a></td>
|
||||
</tr>
|
||||
</t>
|
||||
</table>
|
||||
@@ -25,14 +24,14 @@
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<!-- List of all the surveys -->
|
||||
<!-- Thank you message when the survey is completed -->
|
||||
<template id="finished" name="Survey Finished">
|
||||
<t t-call="website.layout">
|
||||
<div class="wrap">
|
||||
<div class="container">
|
||||
<div class="jumbotron">
|
||||
<h1>Thank you!</h1>
|
||||
<p>Your answers have been recorded.</p>
|
||||
<div t-field="survey.thank_you_message" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,7 +52,7 @@
|
||||
<t t-if="pagination['current'] == -1">
|
||||
<div class='jumbotron'>
|
||||
<h1><span t-field='survey.title'/></h1>
|
||||
<t t-if="survey.description"><p><span t-field='survey.description'/></p></t>
|
||||
<div t-field='survey.description' />
|
||||
<form role="form" method="post" t-att-name="survey.id.__str__() + '_-1'" t-att-action="'/survey/fill/' + survey.id.__str__()" target="">
|
||||
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
|
||||
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
|
||||
@@ -85,11 +84,11 @@
|
||||
<!-- A page -->
|
||||
<template id="page" name="Page">
|
||||
<div class="page-header">
|
||||
<h2><span t-field='page.title' /></h2>
|
||||
<p><t t-if="page.description"><span t-field='page.description'/></t></p>
|
||||
<h1><span t-field='page.title' /></h1>
|
||||
<div t-field='page.description'/>
|
||||
</div>
|
||||
|
||||
<form role="form" method="post" t-att-name="survey.id.__str__() + '_' + pagination['current'].__str__()" t-att-action="'/survey/fill/' + survey.id.__str__()" t-att-data-prefill="'/survey/prefill/' + survey.id.__str__()" t-att-data-validate="'/survey/validate/' + survey.id.__str__()" t-att-data-submit="'/survey/submit/' + survey.id.__str__()">
|
||||
<form role="form" method="post" class="js_surveyform" t-att-name="survey.id.__str__() + '_' + pagination['current'].__str__()" t-att-action="'/survey/fill/' + survey.id.__str__()" t-att-data-prefill="'/survey/prefill/' + survey.id.__str__()" t-att-data-validate="'/survey/validate/' + survey.id.__str__()" t-att-data-submit="'/survey/submit/' + survey.id.__str__()">
|
||||
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
|
||||
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
|
||||
<t t-foreach='page.question_ids' t-as='question'>
|
||||
@@ -106,91 +105,95 @@
|
||||
<template id='question' name='Question'>
|
||||
|
||||
<!-- Detection of matrix/vector elements and creating flags for easy use -->
|
||||
<t t-if="question.parent_id and question.children_ids"><t t-set="is_matrix_vector" t-value="True" /></t>
|
||||
<!-- <t t-if="question.parent_id and question.children_ids"><t t-set="is_matrix_vector" t-value="True" /></t>
|
||||
<t t-if="question.parent_id"><t t-set="is_vector_element" t-value="True" /></t>
|
||||
|
||||
-->
|
||||
<div class="question-wrapper" t-att-id="prefix">
|
||||
|
||||
<t t-if="not is_vector_element"> <!-- if -->
|
||||
<h3><span t-field='question.question' /> <t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h3>
|
||||
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
|
||||
</t>
|
||||
<t t-if="is_vector_element"> <!-- else -->
|
||||
<t t-if="question.type == 'simple_choice_scale'">
|
||||
<span t-field='question.question' t-att-id="prefix"/><t t-raw="'</td><td>'" />
|
||||
<t t-if="question.type in ['free_text']"><t t-call="survey.free_text"/></t>
|
||||
<t t-if="question.type in ['textbox']"><t t-call="survey.textbox"/></t>
|
||||
|
||||
<!-- <h2><span t-field='question.question' /> <t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
|
||||
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p> -->
|
||||
|
||||
|
||||
<!-- instanciating different types of questions -->
|
||||
<!--
|
||||
|
||||
<t t-if="question.type in ['numerical_box']">
|
||||
<input type="number" step=".1" class="form-control" t-att-name="prefix"/>
|
||||
</t>
|
||||
</t> <!-- endif -->
|
||||
|
||||
<!-- instanciating different types of questions -->
|
||||
<t t-if="question.type in ['free_text']">
|
||||
<textarea class="form-control" rows="3" t-att-name="prefix"></textarea>
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['textbox']">
|
||||
<input type="text" class="form-control" t-att-name="prefix"/>
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['numerical_box']">
|
||||
<input type="number" step=".1" class="form-control" t-att-name="prefix"/>
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['datetime']" >
|
||||
<input type="datetime-local" class="form-control" t-att-name="prefix" placeholder="jj-mm-aaaaThh:mm" />
|
||||
TODO: replace html5 datetime widget by OpenERP-CMS datetime widget
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['simple_choice_scale']">
|
||||
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" t-att-name="prefix" t-att-value='suggestion.value' />
|
||||
<span t-field='suggestion.value'/>
|
||||
</label>
|
||||
</div>
|
||||
<t t-if="question.type in ['datetime']" >
|
||||
<input type="datetime-local" class="form-control" t-att-name="prefix" placeholder="jj-mm-aaaaThh:mm" />
|
||||
TODO: replace html5 datetime widget by OpenERP-CMS datetime widget
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['simple_choice_dropdown']">
|
||||
<select class="form-control" t-att-name="prefix">
|
||||
<option disabled="1" selected="1">Choose...</option>
|
||||
<t t-if="question.type in ['simple_choice_scale']">
|
||||
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
||||
<option><t t-esc='suggestion.value'/></option>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" t-att-name="prefix" t-att-value='suggestion.value' />
|
||||
<span t-field='suggestion.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
</select>
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['multiple_choice']">
|
||||
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + suggestion.id.__str__()" t-att-value='suggestion.value' />
|
||||
<span t-field='suggestion.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['matrix']">
|
||||
<table class="table table-responsive">
|
||||
<t t-foreach='question.children_ids' t-as='question'>
|
||||
<t t-call='survey.question' />
|
||||
<t t-if="question.type in ['simple_choice_dropdown']">
|
||||
<select class="form-control" t-att-name="prefix">
|
||||
<option disabled="1" selected="1">Choose...</option>
|
||||
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
||||
<option><t t-esc='suggestion.value'/></option>
|
||||
</t>
|
||||
</select>
|
||||
</t>
|
||||
|
||||
<t t-if="question.type in ['multiple_choice']">
|
||||
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + suggestion.id.__str__()" t-att-value='suggestion.value' />
|
||||
<span t-field='suggestion.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
</table>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<!-- Comments -->
|
||||
<t t-if="question.comments_allowed">
|
||||
Other: <input type="text" class="form-control" />
|
||||
</t>
|
||||
<t t-if="question.type in ['matrix']">
|
||||
<table class="table table-responsive">
|
||||
<t t-foreach='question.children_ids' t-as='question'>
|
||||
<t t-call='survey.question' />
|
||||
</t>
|
||||
</table>
|
||||
</t> -->
|
||||
|
||||
<!-- Comments -->
|
||||
<!-- <t t-if="question.comments_allowed">
|
||||
Other: <input type="text" class="form-control" />
|
||||
</t> -->
|
||||
|
||||
|
||||
<div class="js_errzone alert alert-danger" style="display:none;"></div>
|
||||
<div class="js_errzone alert alert-danger" style="display:none;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<!-- Question widgets -->
|
||||
<template id="free_text" name="Free text box">
|
||||
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
|
||||
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
|
||||
<textarea class="form-control" rows="3" t-att-name="prefix"></textarea>
|
||||
</template>
|
||||
|
||||
<template id="textbox" name="Text box">
|
||||
<h2><span t-field='question.question' /><t t-if="question.constr_mandatory"><abbr title="This question is mandatory." class="text-danger">*</abbr></t></h2>
|
||||
<p class="text-muted"><t t-if="question.description"><span t-field='question.description'/></t></p>
|
||||
<input type="text" class="form-control" t-att-name="prefix"/>
|
||||
</template>
|
||||
|
||||
<!-- Printable view of a survey (all pages) -->
|
||||
<template id="survey_print" name="Survey">
|
||||
<t t-call="website.layout">
|
||||
|
||||
Reference in New Issue
Block a user