[IMP]:survey:improved the view for wizard. ref-YSA
bzr revid: apa@tinyerp.com-20100223121154-v0ngo61c4bf5ikbj
This commit is contained in:
parent
e72c090ed9
commit
e51664b48b
|
@ -693,6 +693,14 @@ class survey_question_wiz(osv.osv_memory):
|
|||
fields = {}
|
||||
if sur_name_read['page'] == "next" or sur_name_rec['page_no'] == - 1 :
|
||||
if len(p_id) > sur_name_rec['page_no'] + 1 :
|
||||
if not context.has_key('active') and not sur_name_rec['page_no'] + 1:
|
||||
cr.execute('select count(id) from survey_history where user_id=%s\
|
||||
and survey_id=%s' % (uid,survey_id))
|
||||
res = cr.fetchone()[0]
|
||||
user_limit = survey_obj.read(cr, uid, survey_id, ['response_user'])['response_user']
|
||||
if user_limit and res >= user_limit:
|
||||
raise osv.except_osv(_('Warning !'),_("You can not give response for this survey more than %s times") % (user_limit))
|
||||
|
||||
if sur_rec['max_response_limit'] and sur_rec['max_response_limit'] <= sur_rec['tot_start_survey'] and not sur_name_rec['page_no'] + 1:
|
||||
survey_obj.write(cr, uid, survey_id, {'state':'close', 'date_close':strftime("%Y-%m-%d %H:%M:%S")})
|
||||
p_id = p_id[sur_name_rec['page_no'] + 1]
|
||||
|
@ -891,7 +899,13 @@ class survey_question_wiz(osv.osv_memory):
|
|||
etree.SubElement(xml_group, 'button', {'icon': "gtk-cancel", 'special': "cancel",'string':"Cancel"})
|
||||
if pre_button:
|
||||
etree.SubElement(xml_group, 'button', {'colspan':"1",'icon':"gtk-go-back",'name':"action_previous",'string':"Previous",'type':"object"})
|
||||
etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'name':"action_next",'string':"Next",'type':"object",'context' : tools.ustr(context)})
|
||||
but_string = "Next"
|
||||
if int(page_number) + 1 == total_pages:
|
||||
but_string = "Done"
|
||||
if context.has_key('active') and int(page_number) + 1 == total_pages:
|
||||
etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'string': "Done" ,'special':"cancel",'context' : tools.ustr(context)})
|
||||
else:
|
||||
etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'name':"action_next",'string': tools.ustr(but_string) ,'type':"object",'context' : tools.ustr(context)})
|
||||
if context.has_key('active') and context.has_key('edit'):
|
||||
etree.SubElement(xml_form, 'separator', {'string' : '','colspan': '4'})
|
||||
context.update({'page_id' : tools.ustr(p_id),'page_number' : sur_name_rec['page_no'] , 'transfer' : sur_name_read['transfer']})
|
||||
|
@ -905,7 +919,6 @@ class survey_question_wiz(osv.osv_memory):
|
|||
result['fields'] = fields
|
||||
result['context'] = context
|
||||
else:
|
||||
if not context.has_key('active'):
|
||||
survey_obj.write(cr, uid, survey_id, {'tot_comp_survey' : sur_rec['tot_comp_survey'] + 1})
|
||||
sur_response_obj = self.pool.get('survey.response')
|
||||
sur_response_obj.write(cr, uid, [sur_name_read['response']], {'state' : 'done'})
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
string="Test Survey" type="action" icon="gtk-new"
|
||||
context="{'active':True,'survey_id': active_id}"/>
|
||||
<button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
|
||||
string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'readonly':[('state','!=','open')]}"/>
|
||||
string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
|
||||
<button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
|
||||
string="Edit Survey" type="action" icon="gtk-edit" context="{'active':True,'edit' : True,'survey_id': active_id}"/>
|
||||
</group>
|
||||
|
@ -239,9 +239,12 @@
|
|||
<field name="tot_comp_survey" select="2" string="Completed"/>
|
||||
<field name="state" select="1"/>
|
||||
<button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
|
||||
string="Test Survey" type="action" icon="gtk-execute" context="{'active':True,'survey_id': active_id}"/>
|
||||
<button name="%(action_view_survey_name)d" states="open,draft,close,cancel"
|
||||
string="Answer Survey" type="action" icon="gtk-new" context="{'survey_id': active_id}"/>
|
||||
string="Test Survey" type="action" icon="gtk-new"
|
||||
context="{'active':True,'survey_id': active_id}"/>
|
||||
<button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
|
||||
string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
|
||||
<button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
|
||||
string="Edit Survey" type="action" icon="gtk-edit" context="{'active':True,'edit' : True,'survey_id': active_id}"/>
|
||||
<button name="%(wizard_print_survey)d" states="open,draft,close,cancel"
|
||||
string="Print Survey" type="action" icon="gtk-print" context="{'active':True,'survey_id': active_id}"/>
|
||||
<button name="%(survey_browse_response)d" states="open,draft,close,cancel"
|
||||
|
|
Loading…
Reference in New Issue