[IMP] Cleaning
bzr revid: rim@openerp.com-20131120161519-4f2kyy38igmbbflb
This commit is contained in:
@@ -111,7 +111,7 @@ class survey_survey(osv.osv):
|
||||
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,),
|
||||
'User responses', readonly=1),
|
||||
'public_url': fields.function(_get_public_url,
|
||||
string="Public link", searchable=True, type="char", store=True),
|
||||
'email_template_id': fields.many2one('email.template',
|
||||
@@ -140,6 +140,7 @@ class survey_survey(osv.osv):
|
||||
current_rec = self.read(cr, uid, ids, context=context)
|
||||
title = _("%s (copy)") % (current_rec.get('title'))
|
||||
vals['title'] = title
|
||||
vals['user_input_ids'] = []
|
||||
return super(survey_survey, self).copy(cr, uid, ids, vals,
|
||||
context=context)
|
||||
|
||||
@@ -599,6 +600,10 @@ class survey_user_input(osv.osv):
|
||||
'token': lambda s, cr, uid, c: uuid.uuid4().__str__(),
|
||||
}
|
||||
|
||||
_sql_constraints = [
|
||||
('unique_token', 'UNIQUE (token)', 'A token must be unique!')
|
||||
]
|
||||
|
||||
def action_survey_resent(self, cr, uid, ids, context=None):
|
||||
record = self.browse(cr, uid, ids[0], context=context)
|
||||
context = context or {}
|
||||
|
||||
@@ -566,43 +566,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Survey Answer
|
||||
-->
|
||||
|
||||
<record model="ir.ui.view" id="survey_answer_form">
|
||||
<field name="name">survey_answer_form</field>
|
||||
<field name="model">survey.answer</field>
|
||||
<field name="arch" type="xml">
|
||||
<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)]}">
|
||||
<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"/>
|
||||
<field name="menu_choice" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id= "survey_answer_tree">
|
||||
<field name="name">survey_answer_tree</field>
|
||||
<field name="model">survey.answer</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom" string="Survey Answer">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="answer"/>
|
||||
<field name="type"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Survey Response Line
|
||||
-->
|
||||
@@ -716,7 +679,7 @@
|
||||
|
||||
<menuitem name="Survey Questions" id="menu_survey_question_form1" action="action_survey_question_form" parent="menu_surveys_configuration" sequence="2"/>
|
||||
|
||||
<menuitem name="Survey labels" id="menu_survey_label_form1" action="action_survey_label_form" parent="menu_surveys_configuration" sequence="3"/>
|
||||
<menuitem name="Survey Labels" id="menu_survey_label_form1" action="action_survey_label_form" parent="menu_surveys_configuration" sequence="3"/>
|
||||
|
||||
<!-- web -->
|
||||
<record id="action_survey_fill2" model="ir.actions.client">
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<div class='jumbotron'>
|
||||
<h1><span t-field='survey.title'/></h1>
|
||||
<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="">
|
||||
<form role="form" method="post" t-att-name="survey.id.__str__() + '_-1'" t-att-action="'/survey/fill/%s/%s' % (survey.id, token)" target="">
|
||||
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
|
||||
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
|
||||
<input type="submit" class="btn btn-primary btn-lg active" value="Take survey"/>
|
||||
@@ -101,7 +101,6 @@
|
||||
<div t-field='page.description'/>
|
||||
<progress t-att-value="pagination['current']+1" t-att-max="len(survey.page_ids)"><t t-raw='"Page %s on %s" % (pagination["current"]+1, len(survey.page_ids))' /></progress>
|
||||
</div>
|
||||
|
||||
<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__()" />
|
||||
@@ -111,56 +110,21 @@
|
||||
</t>
|
||||
<t t-call='survey.navsub' />
|
||||
</form>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<!-- A question -->
|
||||
<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"><t t-set="is_vector_element" t-value="True" /></t>
|
||||
-->
|
||||
<div class="question-wrapper container" t-att-id="prefix">
|
||||
|
||||
<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>
|
||||
<t t-if="question.type in ['numerical_box']"><t t-call="survey.numerical_box"/></t>
|
||||
<t t-if="question.type in ['datetime']"><t t-call="survey.datetime"/></t>
|
||||
<t t-if="question.type in ['simple_choice']"><t t-call="survey.simple_choice"/></t>
|
||||
<t t-if="question.type in ['multiple_choice']"><t t-call="survey.multiple_choice"/></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 ['multiple_choice']">
|
||||
<t t-foreach='question.suggested_answers_ids' t-as='label'>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
|
||||
<span t-field='label.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>
|
||||
</table>
|
||||
</t> -->
|
||||
|
||||
<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>
|
||||
<t t-if="question.type in ['numerical_box']"><t t-call="survey.numerical_box"/></t>
|
||||
<t t-if="question.type in ['datetime']"><t t-call="survey.datetime"/></t>
|
||||
<t t-if="question.type in ['simple_choice']"><t t-call="survey.simple_choice"/></t>
|
||||
<t t-if="question.type in ['multiple_choice']"><t t-call="survey.multiple_choice"/></t>
|
||||
<t t-if="question.type in ['matrix']"><t t-call="survey.matrix"/></t>
|
||||
<div class="js_errzone alert alert-danger" style="display:none;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
@@ -195,25 +159,25 @@
|
||||
<t t-if="question.simple_choice_display == 'dropdown'">
|
||||
<div class="js_drop row">
|
||||
<div class="col-md-6">
|
||||
<select class="form-control" t-att-name="prefix">
|
||||
<option disabled="1" selected="1">Choose...</option>
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<option><t t-esc='label.value'/></option>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<option>Other...</option>
|
||||
</t>
|
||||
</select>
|
||||
<select class="form-control" t-att-name="prefix">
|
||||
<option disabled="1" selected="1">Choose...</option>
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<option><t t-esc='label.value'/></option>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<option>Other...</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_other'" data-oe-survey-othert="1"/>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
|
||||
<div>
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_comments'"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_other'" data-oe-survey-othert="1"/>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
|
||||
<div>
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_comments'"/>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
@@ -274,44 +238,44 @@
|
||||
</t>
|
||||
</div>
|
||||
<div class="row">
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<div class="input-group input-group-sm js_comments col-md-6">
|
||||
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/></span>
|
||||
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<div class="input-group input-group-sm js_comments col-md-6">
|
||||
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/></span>
|
||||
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="question.simple_choice_display == '3col'">
|
||||
<div class="js_radio">
|
||||
<div class="row">
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="radio col-md-4">
|
||||
<label>
|
||||
<input type="radio" t-att-name="prefix" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
<div class="row">
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<div class="input-group input-group-sm js_comments col-md-4">
|
||||
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/></span>
|
||||
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="radio col-md-4">
|
||||
<label>
|
||||
<input type="radio" t-att-name="prefix" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
<div class="row">
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<div class="input-group input-group-sm js_comments col-md-4">
|
||||
<span class="input-group-addon"><input type="radio" t-att-name="prefix" data-oe-survey-otherr="1"/></span>
|
||||
<input type="text" class="form-control" t-att-name="prefix" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if='question.comments_allowed and not question.comment_count_as_answer'>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" t-att-name="prefix+'_comments'" data-oe-survey-othert="1"/>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
@@ -345,14 +309,14 @@
|
||||
</t>
|
||||
<t t-if="question.simple_choice_display == '1col'">
|
||||
<div>
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
<div>
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<div class="input-group input-group-sm col-md-4">
|
||||
@@ -371,14 +335,14 @@
|
||||
</t>
|
||||
<t t-if="question.simple_choice_display == '2col'">
|
||||
<div class="row">
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="checkbox col-md-6">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="checkbox col-md-6">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
<div>
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<div class="input-group input-group-sm col-md-4">
|
||||
@@ -398,14 +362,14 @@
|
||||
</t>
|
||||
<t t-if="question.simple_choice_display == '3col'">
|
||||
<div class="row">
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="checkbox col-md-4">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
<t t-foreach='question.labels_ids' t-as='label'>
|
||||
<div class="checkbox col-md-4">
|
||||
<label>
|
||||
<input type="checkbox" t-att-name="prefix + '_' + label.id.__str__()" t-att-value='label.value' />
|
||||
<span t-field='label.value'/>
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
<div>
|
||||
<t t-if='question.comments_allowed and question.comment_count_as_answer'>
|
||||
<div class="input-group input-group-sm col-md-4">
|
||||
|
||||
Reference in New Issue
Block a user