diff --git a/addons/hr_evaluation/survey_data_appraisal.xml b/addons/hr_evaluation/survey_data_appraisal.xml index d48326116c1..258d421859b 100644 --- a/addons/hr_evaluation/survey_data_appraisal.xml +++ b/addons/hr_evaluation/survey_data_appraisal.xml @@ -5,7 +5,6 @@ Employee Appraisal Form - hr_evaluation <p> </p> @@ -320,7 +319,6 @@ over the coming year.</p> Employee Opinion Form - hr_evaluation <p> </p> diff --git a/addons/hr_recruitment/survey_data_recruitment.xml b/addons/hr_recruitment/survey_data_recruitment.xml index f6aacb0f23c..0e5eb82dabc 100644 --- a/addons/hr_recruitment/survey_data_recruitment.xml +++ b/addons/hr_recruitment/survey_data_recruitment.xml @@ -5,7 +5,6 @@ Recruitment Form - hr_recruitment <p>This form is intended to help the responsible of a recruitment interview.</p> diff --git a/addons/survey/static/description/icon.png b/addons/survey/static/description/icon.png new file mode 100644 index 00000000000..dece1016d57 Binary files /dev/null and b/addons/survey/static/description/icon.png differ diff --git a/addons/survey/static/src/css/survey_result.css b/addons/survey/static/src/css/survey_result.css index 9762bc3866f..967ea1bd74e 100644 --- a/addons/survey/static/src/css/survey_result.css +++ b/addons/survey/static/src/css/survey_result.css @@ -51,3 +51,24 @@ width: 1150px; } } + +.o_preview_questions { + border: 3px solid #C9C6C6; + width: auto; + padding: 10px 30px 5px; + margin-top: 15px; + color: #C9C6C6; +} + +.o_preview_questions .o_datetime { + border: 1px solid #D8D7D7; + margin-bottom: 5px; +} + +.o_preview_questions .o_matrix_head { + border-bottom: 1px solid #D8D7D7; +} + +.o_preview_questions .o_matrix_row { + border-top: 1px solid #D8D7D7; +} diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js index 778bc24ea3d..02ddcd9547d 100644 --- a/addons/survey/static/src/js/survey.js +++ b/addons/survey/static/src/js/survey.js @@ -35,6 +35,7 @@ openerp.website.if_dom_contains('.js_surveyform', function (the_form) { // Printing mode: will disable all the controls in the form if (_.isUndefined(submit_controller)) { + $(".js_surveyform .input-group-addon span.fa-calendar").css("pointer-events", "none"); $('.js_surveyform :input').prop('disabled', true); print_mode = true; } @@ -44,6 +45,18 @@ openerp.website.if_dom_contains('.js_surveyform', function (the_form) { quiz_correction_mode = true; } + $("div.input-group span.fa-calendar").on('click', function(e) { + $(e.currentTarget).closest("div.date").datetimepicker({ + useSeconds: true, + icons : { + time: 'fa fa-clock-o', + date: 'fa fa-calendar', + up: 'fa fa-chevron-up', + down: 'fa fa-chevron-down' + }, + }); + }); + // 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"); diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 612ce78abfa..ec961b9bd2c 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -168,7 +168,6 @@ class survey_survey(osv.Model): _columns = { 'title': fields.char('Title', required=1, translate=True), - 'res_model': fields.char('Category'), 'page_ids': fields.one2many('survey.page', 'survey_id', 'Pages', copy=True), 'stage_id': fields.many2one('survey.stage', string="Stage", ondelete="set null", copy=False), 'auth_required': fields.boolean('Login required', @@ -573,8 +572,8 @@ class survey_question(osv.Model): oldname='descriptive_text'), # Answer - 'type': fields.selection([('free_text', 'Long Text Zone'), - ('textbox', 'Text Input'), + 'type': fields.selection([('free_text', 'Multiple Lines Text Box'), + ('textbox', 'Single Line Text Box'), ('numerical_box', 'Numerical Value'), ('datetime', 'Date and Time'), ('simple_choice', 'Multiple choice: only one answer'), @@ -601,7 +600,7 @@ class survey_question(osv.Model): ('2', '6')], 'Number of columns'), # These options refer to col-xx-[12|6|4|3|2] classes in Bootstrap - 'display_mode': fields.selection([('columns', 'Radio Buttons/Checkboxes'), + 'display_mode': fields.selection([('columns', 'Radio Buttons'), ('dropdown', 'Selection Box')], 'Display mode'), @@ -657,6 +656,9 @@ class survey_question(osv.Model): ('validation_date', 'CHECK (validation_min_date <= validation_max_date)', 'Max date cannot be smaller than min date!') ] + def onchange_validation_email(self, cr, uid, ids, validation_email, context=None): + return {'value': {'validation_required': False}} if validation_email else {} + def copy_data(self, cr, uid, ids, default=None, context=None): current_rec = self.read(cr, uid, ids, context=context) question = _("%s (copy)") % (current_rec.get('question')) @@ -746,7 +748,17 @@ class survey_question(osv.Model): # Answer is not in the right range try: dateanswer = datetime.datetime.strptime(answer, DF) - if not (datetime.datetime.strptime(question.validation_min_date, DF) <= dateanswer <= datetime.datetime.strptime(question.validation_max_date, DF)): + min_date = question.validation_min_date and datetime.datetime.strptime(question.validation_min_date, DF) or False + max_date = question.validation_max_date and datetime.datetime.strptime(question.validation_max_date, DF) or False + + if (min_date and max_date and not(min_date <= dateanswer <= max_date)): + # If Minimum and Maximum Date are entered + errors.update({answer_tag: question.validation_error_msg}) + elif (min_date and not(min_date <= dateanswer)): + # If only Minimum Date is entered and not Define Maximum Date + errors.update({answer_tag: question.validation_error_msg}) + elif (max_date and not(dateanswer <= max_date)): + # If only Maximum Date is entered and not Define Minimum Date errors.update({answer_tag: question.validation_error_msg}) except ValueError: # check that it is a datetime has been done hereunder pass @@ -821,7 +833,7 @@ class survey_label(osv.Model): 'sequence': fields.integer('Label Sequence order'), 'value': fields.char("Suggested value", translate=True, required=True), - 'quizz_mark': fields.float('Score for this answer', help="A positive score indicates a correct answer; a negative or null score indicates a wrong answer"), + 'quizz_mark': fields.float('Score for this choice', help="A positive score indicates a correct choice; a negative or null score indicates a wrong answer"), } _defaults = { 'sequence': 10, @@ -990,7 +1002,7 @@ class survey_user_input_line(osv.Model): 'value_free_text': fields.text("Free Text answer"), 'value_suggested': fields.many2one('survey.label', "Suggested answer"), 'value_suggested_row': fields.many2one('survey.label', "Row answer"), - 'quizz_mark': fields.float("Score given for this answer") + 'quizz_mark': fields.float("Score given for this choice") } _defaults = { diff --git a/addons/survey/views/survey_result.xml b/addons/survey/views/survey_result.xml index bc49f800832..deea5d19b47 100644 --- a/addons/survey/views/survey_result.xml +++ b/addons/survey/views/survey_result.xml @@ -14,6 +14,7 @@
+

@@ -98,17 +99,17 @@ -
+
-
+
-
+
@@ -326,6 +327,7 @@ + + +