[IMP]:Survey:-improved survey.request view and browse report of the survey module.(Ref.YSA).
bzr revid: apa@tinyerp.com-20100121073843-e2eq3p78f54qgwu6
This commit is contained in:
@@ -145,7 +145,11 @@ class survey_browse_response(report_rml):
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
answer = surv_resp_line_obj.browse(cr,uid, surv_resp_line_obj.search(cr, uid, [('question_id','=',que.id),('response_id','=',response.id)]))
|
||||
if que.type in ['table']:
|
||||
if que.type in ['descriptive_text']:
|
||||
rml +="""<blockTable colWidths="500" style="Table1">
|
||||
<tr> <td> <para style="response">""" + to_xml(que.descriptive_text) + """</para></td> </tr>
|
||||
</blockTable>"""
|
||||
elif que.type in ['table']:
|
||||
if len(answer) and answer[0].state == "done":
|
||||
col_heading = pooler.get_pool(cr.dbname).get('survey.tbl.column.heading')
|
||||
cols_widhts = []
|
||||
@@ -262,7 +266,7 @@ class survey_browse_response(report_rml):
|
||||
value = """"""
|
||||
for res_ans in answer[0].response_answer_ids:
|
||||
if res_ans.answer_id.id == ans.id and res_ans.answer == matrix_ans[mat_col]:
|
||||
comment_value = """<para style="response">""" + to_xml(tools.ustr(res_ans.comment_field)) + """</para>"""
|
||||
comment_value = to_xml(tools.ustr(res_ans.comment_field))
|
||||
if que.type in ['matrix_of_drop_down_menus']:
|
||||
value = """<para style="response">""" + to_xml(tools.ustr(res_ans.value_choice)) + """</para>"""
|
||||
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
|
||||
@@ -292,7 +296,9 @@ class survey_browse_response(report_rml):
|
||||
</illustration>"""
|
||||
rml+= """<td>""" + value + """</td>"""
|
||||
if que.comment_column:
|
||||
rml+= """<td>""" + comment_value + """</td>"""
|
||||
if comment_value=='False':
|
||||
comment_value = ''
|
||||
rml+= """<td><para style="response">"""+ comment_value + """</para></td>"""
|
||||
rml+=""" </tr></blockTable>"""
|
||||
if que.comment_field_type:
|
||||
rml+="""<blockTable colWidths="500" style="Table1"><tr>
|
||||
|
||||
+27
-2
@@ -29,6 +29,7 @@ from tools.translate import _
|
||||
from lxml import etree
|
||||
from tools import to_xml
|
||||
import tools
|
||||
from mx.DateTime import *
|
||||
|
||||
class survey(osv.osv):
|
||||
_name = 'survey'
|
||||
@@ -735,7 +736,8 @@ class survey_question_wiz(osv.osv_memory):
|
||||
etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_" + tools.ustr(ans['id'])})
|
||||
fields[tools.ustr(que) + "_" + tools.ustr(ans['id'])] = {'type':'datetime', 'string':ans['answer']}
|
||||
elif que_rec['type'] == 'descriptive_text':
|
||||
etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_rec['descriptive_text']))})
|
||||
for que_test in que_rec['descriptive_text'].split('\n'):
|
||||
etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"})
|
||||
elif que_rec['type'] == 'single_textbox':
|
||||
etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_single", 'nolabel':"1" ,'colspan':"4"})
|
||||
fields[tools.ustr(que) + "_single"] = {'type':'char', 'size' : 255, 'string':"single_textbox", 'views':{}}
|
||||
@@ -1341,14 +1343,37 @@ res_users()
|
||||
class survey_request(osv.osv):
|
||||
_name = "survey.request"
|
||||
_order = 'date_deadline'
|
||||
_rec_name = 'date_deadline'
|
||||
_columns = {
|
||||
'date_deadline' : fields.date("Deadline date"),
|
||||
'user_id' : fields.many2one("res.users", "User"),
|
||||
'email' : fields.char("E-mail", size=64),
|
||||
'survey_id' : fields.many2one("survey", "Survey", required=1),
|
||||
'answer_ids' : fields.one2many('survey.answer', 'question_id', 'Answer'),
|
||||
'state' : fields.selection([('waitin_answer', 'Wating Answer'),('done', 'Done'),('cancelled', 'Cancelled')], 'State')
|
||||
'state' : fields.selection([('waiting_answer', 'Wating Answer'),('done', 'Done'),('cancel', 'Cancelled')], 'State', readonly=1)
|
||||
}
|
||||
_defaults = {
|
||||
'state' : lambda * a: 'waiting_answer',
|
||||
'date_deadline' : lambda * a : (now() + RelativeDateTime(months=+1)).strftime("%Y-%m-%d %H:%M:%S")
|
||||
}
|
||||
def survey_req_waiting_answer(self, cr, uid, ids, arg):
|
||||
self.write(cr, uid, ids, { 'state' : 'waiting_answer'})
|
||||
return True
|
||||
|
||||
def survey_req_done(self, cr, uid, ids, arg):
|
||||
self.write(cr, uid, ids, { 'state' : 'done'})
|
||||
return True
|
||||
|
||||
def survey_req_cancel(self, cr, uid, ids, arg):
|
||||
self.write(cr, uid, ids, { 'state' : 'cancel'})
|
||||
return True
|
||||
|
||||
def on_change_user(self, cr, uid, ids, user_id, context=None):
|
||||
if user_id:
|
||||
user_obj = self.pool.get('res.users')
|
||||
user = user_obj.browse(cr, uid, user_id)
|
||||
return {'value': {'email': user.address_id.email}}
|
||||
return {}
|
||||
|
||||
survey_request()
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
<!-- <menuitem name="Configuration" id="menu_survey_config"
|
||||
parent="main_menu_survey" groups="group_survey_manager"/>-->
|
||||
<menuitem name="Configuration" parent="base.menu_tools"
|
||||
id="base.menu_lunch_survey_root" sequence="5"/>
|
||||
<menuitem name="survey" id="menu_survey_config"
|
||||
parent="base.menu_lunch_survey_root" groups="group_survey_manager"/>
|
||||
id="base.menu_lunch_survey_root" groups="group_survey_manager" sequence="5"/>
|
||||
<menuitem name="survey" id="menu_survey_config"
|
||||
parent="base.menu_lunch_survey_root" groups="group_survey_manager"/>
|
||||
<!--
|
||||
Survey
|
||||
-->
|
||||
@@ -958,10 +958,15 @@
|
||||
<form string="Survey Request">
|
||||
<field name="date_deadline"/>
|
||||
<field name="survey_id"/>
|
||||
<field name="user_id" on_change="on_change_user(user_id)"/>
|
||||
<field name="email"/>
|
||||
<field name="user_id"/>
|
||||
<field name="answer_ids" nolabel="1" colspan="4"/>
|
||||
<field name="state"/>
|
||||
<field name="answer_ids" nolabel="1" colspan="4"/>
|
||||
<group colspan="4" col="5">
|
||||
<field name="state"/>
|
||||
<button name="survey_req_waiting_answer" string="Set to Watting Answer" states="cancel,done" type="object" icon="gtk-new"/>
|
||||
<button name="survey_req_done" string="Done" states="waiting_answer" type="object" icon="gtk-ok"/>
|
||||
<button name="survey_req_cancel" string="Cancelled" states="waiting_answer" type="object" icon="gtk-cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user