[IMP]:survey,hr_evaluation.(Ref-YSA,APA).
authorapa-tiny <apa@tinyerp.com>
Wed, 3 Feb 2010 08:35:53 +0000 (14:05 +0530)
committerapa-tiny <apa@tinyerp.com>
Wed, 3 Feb 2010 08:35:53 +0000 (14:05 +0530)
Fixed:
-Survey analysis report error.
-Table contain not display.
-Create question type= drop down menu... then error menu choice not exists.
-Status change in survey.response. finished and not finished.
-Remove button in survey.response.
-Response display page wise.
-Evaluation data changed.

bzr revid: apa@tinyerp.com-20100203083553-th7b1jq7ksskitjo

addons/hr_evaluation/hr_evaluation_data.xml
addons/survey/report/survey_analysis_report.py
addons/survey/report/survey_browse_response.py
addons/survey/report/survey_form.py
addons/survey/survey.py
addons/survey/survey_demo.xml
addons/survey/survey_view.xml

index 2a3d72d..d2223e4 100644 (file)
                        <field name="title">EMPLOYEE PERFORMANCE IN KEY AREAS</field>
                        <field name="survey_id" ref="survey_2"/>
                        <field eval="3" name="sequence"/>
+                       <field name="note">The appraiser should rate the employee’s major work accomplishments and performance according to the metric provided below :
+                               1 - Significantly exceeds standards and expectations required of the position
+                               2 - Exceeds standards and expectations
+                               3 - Meet standards and expectations
+                               4 - Did not meet standards and expectations
+                               5 - Significantly below standards and expectations  </field>
                </record>
        </data>
 
+       <data>
+               <record id="survey_page_16" model="survey.page">
+                       <field name="title">PROFESSIONAL DEVELOPMENT AND PERFORMANCE PLAN (optional)</field>
+                       <field name="survey_id" ref="survey_2"/>
+                       <field eval="4" name="sequence"/>
+                       <field name="note">Identify professional, performance, or project objectives you recommend for employee’s continued career development over the coming year. </field>
+               </record>
+       </data>
+
+       <data>
+               <record id="survey_page_26" model="survey.page">
+                       <field name="title">EMPLOYEE COMMENTS</field>
+                       <field name="survey_id" ref="survey_2"/>
+                       <field eval="5" name="sequence"/>
+               </record>
+       </data>
 
        <data>
                <record id="survey_page_10" model="survey.page">
@@ -519,7 +541,14 @@ Once the form had been filled, the employee send it to his supervisor.
                        <field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
                        <field name="descriptive_text">* 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 the company, ...
 
-* 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.</field>
+* 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.
+* The appraiser should rate the employee’s major work accomplishments and    performance according to the metric provided below :
+
+       1 - Significantly exceeds standards and expectations required of the position
+       2 - Exceeds standards and expectations
+       3 - Meet standards and expectations
+       4 - Did not meet standards and expectations
+       5 - Significantly below standards and expectations</field>
                        <field eval="0" name="make_comment_field"/>
                        <field eval="1" name="in_visible_menu_choice"/>
                        <field name="page_id" ref="survey_page_2"/>
@@ -573,9 +602,102 @@ Once the form had been filled, the employee send it to his supervisor.
                </record>
        </data-->
 
+       <data>
+               <record id="survey_question_17_1" model="survey.question">
+                       <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">PROFESSIONAL DEVELOPMENT OBJECTIVES </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="0" name="in_visible_menu_choice"/>
+                       <field name="page_id" ref="survey_page_16"/>
+                       <field name="comment_label">Other</field>
+                       <field eval="0" name="in_visible_rating_weight"/>
+                       <field eval="0" name="allow_comment"/>
+               </record>
+       </data>
 
+       <data>
+               <record id="survey_question_17_2" model="survey.question">
+                       <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">PERSONAL PERFORMANCE OBJECTIVES</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="0" name="in_visible_menu_choice"/>
+                       <field name="page_id" ref="survey_page_16"/>
+                       <field name="comment_label">Other</field>
+                       <field eval="0" name="in_visible_rating_weight"/>
+                       <field eval="0" name="allow_comment"/>
+               </record>
+       </data>
+
+       <data>
+               <record id="survey_question_17_3" model="survey.question">
+                       <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">PROJECT OBJECTIVES</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="0" name="in_visible_menu_choice"/>
+                       <field name="page_id" ref="survey_page_16"/>
+                       <field name="comment_label">Other</field>
+                       <field eval="0" name="in_visible_rating_weight"/>
+                       <field eval="0" name="allow_comment"/>
+               </record>
+       </data>
 
        <data>
+               <record id="survey_question_17_2_12" model="survey.question">
+                       <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="5" name="sequence"/>
+                       <field name="question">Use the following space to make any comments regarding the above performance evaluation.</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="0" name="in_visible_menu_choice"/>
+                       <field name="page_id" ref="survey_page_26"/>
+                       <field name="comment_label">Other</field>
+                       <field eval="0" name="in_visible_rating_weight"/>
+                       <field eval="0" name="allow_comment"/>
+               </record>
+       </data>
+       <data>
                <record id="survey_question_column_heading_4" model="survey.question.column.heading">
                        <field eval="0" name="in_visible_menu_choice"/>
                        <field name="title">1</field>
index 0694880..b9c74eb 100755 (executable)
@@ -167,7 +167,7 @@ class survey_analysis(report_rml):
                                     if cal['answer'] == matrix_ans[mat_col]:
                                         cal_count = cal['count']
                                 if tot_res:
-                                    percantage = float(cal_count)*100 / 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:
@@ -257,14 +257,17 @@ class survey_analysis(report_rml):
                                         sqc.question_id = sr.question_id  and sra.answer_id = %d and sqc.title ='%s'\
                                         group by sra.answer_id,sqc.rating_weight" % (ans.id,matrix_ans[mat_col]))
                                 col_weight =  cr.fetchone()
-                                if not col_weight :
+                                
+                                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:
-                                    rating_weight_sum += col_weight[1] * tot_res
+                                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_res = 0
+                                    tor_res = 0
                                     tot_per = 0.0
                                 if tot_res:
                                     rml += """<td><para style="answer_bold">""" + tools.ustr(tot_per) + "%(" + tools.ustr(tot_res) + """)</para></td>"""
@@ -309,7 +312,7 @@ class survey_analysis(report_rml):
                                             calc = per['count']
                                     percantage = 0.00
                                     if calc and response:
-                                        percantage = (float(calc)* 100) / 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:
index 6e26f21..a1e07cd 100644 (file)
@@ -51,6 +51,10 @@ class survey_browse_response(report_rml):
                       <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"/>
@@ -139,11 +143,11 @@ class survey_browse_response(report_rml):
             response_id = surv_resp_obj.search(cr, uid, [('survey_id','in',ids)])
         surv_resp_line_obj = pooler.get_pool(cr.dbname).get('survey.response.line')
         surv_obj = pooler.get_pool(cr.dbname).get('survey')
-        for response in surv_resp_obj.browse(cr,uid, response_id): 
+        for response in surv_resp_obj.browse(cr,uid, response_id):
             for survey in surv_obj.browse(cr, uid, [response.survey_id.id]):
-                status = "Skip"
+                status = "Not Finished"
                 if response.state == "done":
-                    status = "Complete"
+                    status = "Finished"
                 rml += """<blockTable colWidths="230.0,120.0,100.0,50" style="Table_heading">
                           <tr>
                             <td>
@@ -183,6 +187,13 @@ class survey_browse_response(report_rml):
                                     <td><para style="page">Page :- """ + to_xml(tools.ustr(page.title)) + """</para></td>
                                   </tr>
                                </blockTable>"""
+                    if page.note:
+                        rml += """<para style="P2"></para>
+                             <blockTable colWidths="500" style="note_table">
+                                  <tr>
+                                    <td><para style="response">""" + to_xml(tools.ustr(page.note)) + """</para></td>
+                                  </tr>
+                               </blockTable>"""
                     for que in page.question_ids:
                         rml += """<para style="P2"></para>
                                 <blockTable colWidths="500" style="Table5">
@@ -213,11 +224,14 @@ class survey_browse_response(report_rml):
                                     rml +="""<blockTable colWidths=" """ + str(colWidths) + """ " style="Table51"><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 = """<font color="white"> </font>"""
+                                        value = False
                                         for col in table_data:
                                             if column == col.column_id.title:
                                                 value = col.value
-                                        rml += """<td> <para style="terp_default_9">""" + to_xml(tools.ustr(value)) +"""</para></td>"""
+                                        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="500" style="Table1">
@@ -354,8 +368,8 @@ class survey_browse_response(report_rml):
                                 rml +="""<blockTable colWidths="500" style="Table1">
                                  <tr>  <td> <para style="response">No Response</para></td> </tr>
                                 </blockTable>"""
-                
-                rml += """<pageBreak/>"""
+
+                    rml += """<pageBreak/>"""
         rml += """</story></document>"""
         report_type = datas.get('report_type', 'pdf')
         create_doc = self.generators[report_type]
index 725e213..0cdc919 100644 (file)
@@ -102,6 +102,10 @@ class survey_form(report_rml):
               <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="Table4">
               <blockAlignment value="LEFT"/>
               <blockValign value="TOP"/>
@@ -147,6 +151,10 @@ class survey_form(report_rml):
                 <blockTable colWidths='"""+_tbl_widths+"""' style="page_tbl">
                     <tr><td><para style="page">"""+ tools.ustr(seq) + """. """ + to_xml(tools.ustr(page.title)) + """</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 +="""
index 632f4c7..8f3f822 100644 (file)
@@ -331,9 +331,9 @@ class survey_question(osv.osv):
                         raise osv.except_osv(_('Error !'),_("Maximum Required Answer is greater than Minimum Required Answer"))
             if question['type'] ==  'matrix_of_drop_down_menus' and vals.has_key('column_heading_ids'):
                 for col in vals['column_heading_ids']:
-                    if col[2] and  col[2].has_key('menu_choice') and not col[2]['menu_choice']:
+                    if not col[2] or not col[2].has_key('menu_choice') or not col[2]['menu_choice']:
                         raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading"))
-                    elif col[2] and col[2].has_key('menu_choice') and col[2]['menu_choice'].strip() == '':
+                    elif not col[2] or not col[2].has_key('menu_choice') or col[2]['menu_choice'].strip() == '':
                         raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading (white spaces not allowed)"))
         return super(survey_question, self).write(cr, uid, ids, vals, context=context)
 
@@ -361,9 +361,9 @@ class survey_question(osv.osv):
                     raise osv.except_osv(_('Error !'),_("Maximum Required Answer is greater than Minimum Required Answer"))
         if vals['type'] ==  'matrix_of_drop_down_menus':
             for col in vals['column_heading_ids']:
-                if not col[2]['menu_choice']:
+                if not col[2] or not col[2].has_key('menu_choice') or not col[2]['menu_choice']:
                     raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading"))
-                elif col[2]['menu_choice'].strip() == '':
+                elif not col[2] or not col[2].has_key('menu_choice') or col[2]['menu_choice'].strip() == '':
                     raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading (white spaces not allowed)"))
         res = super(survey_question, self).create(cr, uid, vals, context)
         return res
@@ -479,18 +479,11 @@ class survey_response(osv.osv):
         'user_id' : fields.many2one('res.users', 'User'),
         'response_type' : fields.selection([('manually', 'Manually'), ('link', 'Link')], 'Response Type', required=1),
         'question_ids' : fields.one2many('survey.response.line', 'response_id', 'Response Answer'),
-        'state' : fields.selection([('done', 'Completed '),('skip', 'Skiped')], 'Status', readonly=True),
+        'state' : fields.selection([('done', 'Finished '),('skip', 'Not Finished')], 'Status', readonly=True),
     }
     _defaults = {
         'state' : lambda * a: "skip",
     }
-    def response_done(self, cr, uid, ids, arg):
-        self.write(cr, uid, ids, { 'state' : 'done' })
-        return True
-
-    def response_skip(self, cr, uid, ids, arg):
-        self.write(cr, uid, ids, { 'state' : 'skip' })
-        return True
 
 survey_response()
 
@@ -765,9 +758,20 @@ class survey_question_wiz(osv.osv_memory):
                                     fields[tools.ustr(que) + "_" + tools.ustr(row['id'])  + "_" + tools.ustr(col['title'])] = {'type':'selection', 'string': col['title'], 'selection':selection}
                         elif que_rec['type'] == 'multiple_textboxes':
                             xml_group = etree.SubElement(xml_group, 'group', {'col': '1', 'colspan': '4'})
+                            type = "char"
+                            if que_rec['is_validation_require']:
+                                if que_rec['validation_type'] in ['must_be_whole_number']:
+                                    type = "integer"
+                                elif que_rec['validation_type'] in ['must_be_decimal_number']:
+                                    type = "float"
+                                elif que_rec['validation_type'] in ['must_be_date']:
+                                    type = "date"
                             for ans in ans_ids:
                                 etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"})
-                                fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type':'char', 'size':255, 'string':ans['answer']}
+                                if type == "char" :
+                                    fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type':'char', 'size':255, 'string':ans['answer']}
+                                else:
+                                    fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type': str(type), 'string':ans['answer']}
                         elif que_rec['type'] == 'numerical_textboxes':
                             xml_group = etree.SubElement(xml_group, 'group', {'col': '2', 'colspan': '2'})
                             for ans in ans_ids:
@@ -969,6 +973,7 @@ class survey_question_wiz(osv.osv_memory):
                     comment_value = False
                     response_list = []
                     for key1, val1 in vals.items():
+                        print "FOR::::::::::",key1,val1
                         if val1 and key1.split('_')[1] == "table" and key1.split('_')[0] == que_id:
                             surv_tbl_column_obj.create(cr, uid, {'response_table_id' : resp_id,'column_id':key1.split('_')[2], 'name':key1.split('_')[3], 'value' : val1})
                             sur_name_read['store_ans'][resp_id].update({key1:val1})
@@ -1069,10 +1074,13 @@ class survey_question_wiz(osv.osv_memory):
                             select_count += 1
                             numeric_sum += int(val1)
                         elif val1 and que_id == key1.split('_')[0] and len(key1.split('_')) == 3:
+                            print "V:::::::::::::::::",key1, val1
                             if type(val1) == type('') or type(val1) == type(u''):
+                                print "VA:::::::::::::::::::DROP DOWN::::::::"
                                 ans_create_id = res_ans_obj.create(cr, uid, {'response_id':resp_id, 'answer_id':key1.split('_')[1], 'answer' : key1.split('_')[2], 'value_choice' : val1})
                                 sur_name_read['store_ans'][resp_id].update({key1:val1})
                             else:
+                                print ":A:::::::::::::multiple answer :::"
                                 ans_create_id = res_ans_obj.create(cr, uid, {'response_id':resp_id, 'answer_id':key1.split('_')[1], 'answer' : key1.split('_')[2]})
                                 sur_name_read['store_ans'][resp_id].update({key1:True})
                             matrix_list.append(key1.split('_')[0] + '_' + key1.split('_')[1])
index 88f632a..03ac38d 100644 (file)
         <record id="survey_question_partners_on_which_subjects" model="survey.question">
             <field name="question">In your opinion, how could Tiny better communicate with partners and on which subjects?</field>
             <field name="page_id" ref="survey_page_communication" />
-            <field name="type">single_textbox</field>
+            <field name="type">comment</field>
             <field name="in_visible_rating_weight">1</field>
             <field name="in_visible_menu_choice">1</field>
             <field eval="4" name="sequence"/>
index 5085ed4..5c84eb6 100644 (file)
                     <field name="user_id" select="1"/>
                     <field name="response_type" select="1"/>
                     <field name="question_ids" nolabel="1" colspan="4" />
-                    <group col="5" colspan="4">
-                        <field name="state"/>
-                        <button name="response_done" string="Done"
-                            states="skip" type="object" icon="gtk-go-forward"/>
-                        <button name="response_skip" string="Skip"
-                            states="done" type="object" icon="gtk-close"/>
-                    </group>
+                    <field name="state" select="1"/>
                 </form>
             </field>
         </record>
                     <field name="date_create" select="1"/>
                     <field name="user_id" select="1"/>
                     <field name="response_type" select="1"/>
+                    <field name="state" select="1"/>
                 </tree>
             </field>
         </record>