[MERGE] survey review
bzr revid: qdp-launchpad@openerp.com-20121024000215-l9ymy2p2783lo56l
This commit is contained in:
commit
0efbb1aacc
|
@ -77,6 +77,7 @@ class survey(osv.osv):
|
|||
'tot_comp_survey': lambda * a: 0,
|
||||
'send_response': lambda * a: 1,
|
||||
'response_user': lambda * a:1,
|
||||
'date_open': fields.datetime.now,
|
||||
}
|
||||
|
||||
def survey_open(self, cr, uid, ids, arg):
|
||||
|
@ -151,8 +152,7 @@ class survey(osv.osv):
|
|||
pages = sur['page_ids']
|
||||
if not pages:
|
||||
raise osv.except_osv(_('Warning!'), _('This survey has no question defined. Please define the questions and answers first.'))
|
||||
else:
|
||||
context.update({'active':False,'survey_id': ids[0]})
|
||||
context.update({'active':False,'survey_id': ids[0]})
|
||||
return {
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
|
@ -163,9 +163,12 @@ class survey(osv.osv):
|
|||
'context': context
|
||||
}
|
||||
def test_survey(self, cr, uid, ids, context=None):
|
||||
sur_obj = self.read(cr, uid, ids,['title'], context=context)
|
||||
sur_obj = self.read(cr, uid, ids,['title','page_ids'], context=context)
|
||||
for sur in sur_obj:
|
||||
name = sur['title']
|
||||
pages = sur['page_ids']
|
||||
if not pages:
|
||||
raise osv.except_osv(_('Warning!'), _('This survey has no pages defined. Please define pages first.'))
|
||||
context.update({'active':True,'survey_id': ids[0]})
|
||||
return {
|
||||
'view_type': 'form',
|
||||
|
|
|
@ -38,24 +38,24 @@
|
|||
<div class="oe_title">
|
||||
<label for="title" class="oe_edit_only"/>
|
||||
<h1>
|
||||
<field name="title"/>
|
||||
<field name="title" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="id" invisible="1"/>
|
||||
<field name="responsible_id" class="oe_inline"/>
|
||||
<field name="send_response"/>
|
||||
<field name="type"/>
|
||||
<field name="responsible_id" class="oe_inline" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
<field name="send_response" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
<field name="type" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="max_response_limit" attrs="{'readonly':[('state','in',('open','close'))]}"/>
|
||||
<field name="response_user" attrs="{'readonly':[('state','in',('open','close'))]}"/>
|
||||
<field name="max_response_limit" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
<field name="response_user" attrs="{'readonly':[('state','=','close')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Survey Details">
|
||||
<field name="page_ids" colspan="4" mode="tree">
|
||||
<field name="page_ids" colspan="4" mode="tree" attrs="{'readonly':[('state','=','close')]}">
|
||||
<form string="Survey Page" version="7.0">
|
||||
<sheet>
|
||||
<label for="title" class="oe_edit_only"/>
|
||||
|
@ -212,7 +212,7 @@
|
|||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
<field name="note" placeholder="Survey description..."/>
|
||||
<field name="note" placeholder="Survey description..." attrs="{'readonly':[('state','=','close')]}"/>
|
||||
</page>
|
||||
<page string="Invited User">
|
||||
<field name="invited_user_ids" readonly="1"/>
|
||||
|
|
|
@ -134,6 +134,8 @@ class survey_question_wiz(osv.osv_memory):
|
|||
page_number += 1
|
||||
if sur_name_rec.page_no > - 1:
|
||||
pre_button = True
|
||||
else:
|
||||
flag = True
|
||||
else:
|
||||
if sur_name_rec.page_no != 0:
|
||||
p_id = p_id[sur_name_rec.page_no - 1]
|
||||
|
@ -146,7 +148,15 @@ class survey_question_wiz(osv.osv_memory):
|
|||
pre_button = True
|
||||
if flag:
|
||||
pag_rec = page_obj.browse(cr, uid, p_id, context=context)
|
||||
xml_form = etree.Element('form', {'string': tools.ustr(pag_rec.title or sur_rec.title)})
|
||||
note = False
|
||||
question_ids = []
|
||||
if pag_rec:
|
||||
title = pag_rec.title
|
||||
note = pag_rec.note
|
||||
question_ids = pag_rec.question_ids
|
||||
else:
|
||||
title = sur_rec.title
|
||||
xml_form = etree.Element('form', {'string': tools.ustr(title)})
|
||||
if context.has_key('active') and context.get('active',False) and context.has_key('edit'):
|
||||
context.update({'page_id' : tools.ustr(p_id),'page_number' : sur_name_rec.page_no , 'transfer' : sur_name_read.transfer})
|
||||
xml_group3 = etree.SubElement(xml_form, 'group', {'col': '4', 'colspan': '4'})
|
||||
|
@ -174,10 +184,10 @@ class survey_question_wiz(osv.osv_memory):
|
|||
fields["wizardid_" + str(wiz_id)] = {'type':'char', 'size' : 255, 'string':"", 'views':{}}
|
||||
etree.SubElement(xml_form, 'field', {'invisible':'1','name': "wizardid_" + str(wiz_id),'default':str(lambda *a: 0),'modifiers':'{"invisible":true}'})
|
||||
|
||||
if pag_rec.note:
|
||||
for que_test in pag_rec.note.split('\n'):
|
||||
if note:
|
||||
for que_test in note.split('\n'):
|
||||
etree.SubElement(xml_form, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"})
|
||||
que_ids = pag_rec.question_ids
|
||||
que_ids = question_ids
|
||||
qu_no = 0
|
||||
|
||||
for que in que_ids:
|
||||
|
@ -429,13 +439,13 @@ class survey_question_wiz(osv.osv_memory):
|
|||
vals['attachment_ids'] = [(0,0,{'name': a_name,
|
||||
'datas_fname': a_name,
|
||||
'datas': str(a_content).encode('base64')})
|
||||
for a_name, a_content in attachments]
|
||||
for a_name, a_content in attachments.items()]
|
||||
self.pool.get('mail.mail').create(cr, uid, vals, context=context)
|
||||
|
||||
xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
|
||||
xml_footer = etree.SubElement(xml_form, 'footer', {'col': '6', 'colspan': '4' ,'class': 'oe_survey_title_height'})
|
||||
|
||||
etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"})
|
||||
etree.SubElement(xml_form, 'separator', {'string': 'Survey Completed', 'colspan': "4"})
|
||||
etree.SubElement(xml_form, 'label', {'string': 'Thanks for your Answer'})
|
||||
etree.SubElement(xml_form, 'newline')
|
||||
etree.SubElement(xml_footer, 'button', {'special':"cancel",'string':"OK",'colspan':"2",'class':'oe_highlight'})
|
||||
|
|
|
@ -50,9 +50,6 @@ class survey_send_invitation(osv.osv_memory):
|
|||
_defaults = {
|
||||
'send_mail': lambda *a: 1,
|
||||
'send_mail_existing': lambda *a: 1,
|
||||
'mail_subject': lambda *a: "Invitation",
|
||||
'mail_subject_existing': lambda *a: "Invitation",
|
||||
'mail_from': lambda *a: tools.config['email_from']
|
||||
}
|
||||
|
||||
def genpasswd(self):
|
||||
|
@ -67,14 +64,23 @@ class survey_send_invitation(osv.osv_memory):
|
|||
msg = ""
|
||||
name = ""
|
||||
for sur in survey_obj.browse(cr, uid, context.get('active_ids', []), context=context):
|
||||
name += "\t --> " + sur.title + "\n"
|
||||
name += "\n --> " + sur.title + "\n"
|
||||
if sur.state != 'open':
|
||||
msg += sur.title + "\n"
|
||||
data['mail_subject'] = _("Invitation for %s") % (sur.title)
|
||||
data['mail_subject_existing'] = _("Invitation for %s") % (sur.title)
|
||||
data['mail_from'] = sur.responsible_id.email
|
||||
if msg:
|
||||
raise osv.except_osv(_('Warning!'), _('%sSurvey is not in open state') % msg)
|
||||
data['mail'] = '''Hello %(name)s, \n\n We are inviting you for following survey. \
|
||||
\n ''' + name + '''\n Your login ID: %(login)s, Your password: %(passwd)s
|
||||
\n link :- http://'''+ str(socket.gethostname()) + ''':8080 \n\n Thanks,'''
|
||||
raise osv.except_osv(_('Warning!'), _('The following surveys are not in open state: %s') % msg)
|
||||
data['mail'] = _('''
|
||||
Hello %%(name)s, \n\n
|
||||
Would you please spent some of your time to fill-in our survey: \n%s\n
|
||||
You can access this survey with the following parameters:
|
||||
URL: %s
|
||||
Your login ID: %%(login)s\n
|
||||
Your password: %%(passwd)s\n
|
||||
\n\n
|
||||
Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context))
|
||||
return data
|
||||
|
||||
def create_report(self, cr, uid, res_ids, report_name=False, file_name=False):
|
||||
|
@ -176,7 +182,7 @@ class survey_send_invitation(osv.osv_memory):
|
|||
vals['attachment_ids'] = [(0,0,{'name': a_name,
|
||||
'datas_fname': a_name,
|
||||
'datas': str(a_content).encode('base64')})
|
||||
for a_name, a_content in attachments]
|
||||
for a_name, a_content in attachments.items()]
|
||||
ans = self.pool.get('mail.mail').create(cr, uid, vals, context=context)
|
||||
if ans:
|
||||
res_data = {'name': partner.name or _('Unknown'),
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</header>
|
||||
<group col="4">
|
||||
<separator string="Select Partner" colspan="4"/>
|
||||
<field name="partner_ids" nolabel="1" colspan="4"/>
|
||||
<field name="partner_ids" nolabel="1" colspan="4" widget="many2many_tags"/>
|
||||
<separator colspan="4" string="Send Mail for New User"/>
|
||||
<field name="send_mail" nolabel="1"/>
|
||||
<field name="mail_subject" colspan="3"/>
|
||||
|
|
Loading…
Reference in New Issue