[IMP] survey: code review

bzr revid: qdp-launchpad@openerp.com-20121023144746-aidxyhxho59irw2d
This commit is contained in:
Quentin (OpenERP)
2012-10-23 16:47:46 +02:00
parent ab2a68b55c
commit f57cc2402d
4 changed files with 15 additions and 12 deletions
+2 -4
View File
@@ -152,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',
@@ -170,8 +169,7 @@ class survey(osv.osv):
pages = sur['page_ids']
if not pages:
raise osv.except_osv(_('Warning!'), _('This survey has no pages defined. Please define pages first.'))
else:
context.update({'active':True,'survey_id': ids[0]})
context.update({'active':True,'survey_id': ids[0]})
return {
'view_type': 'form',
'view_mode': 'form',
+1 -1
View File
@@ -215,7 +215,7 @@
<field name="note" placeholder="Survey description..." attrs="{'readonly':[('state','=','close')]}"/>
</page>
<page string="Invited User">
<field name="invited_user_ids" attrs="{'readonly':[('state','=','close')]}"/>
<field name="invited_user_ids" readonly="1"/>
</page>
<page string="History">
<group>
+2 -2
View File
@@ -153,9 +153,9 @@ class survey_question_wiz(osv.osv_memory):
if pag_rec:
title = pag_rec.title
note = pag_rec.note
question_ids=pag_rec.question_ids
question_ids = pag_rec.question_ids
else:
title=sur_rec.title
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})
+10 -5
View File
@@ -67,14 +67,19 @@ class survey_send_invitation(osv.osv_memory):
name += "\t --> " + sur.title + "\n"
if sur.state != 'open':
msg += sur.title + "\n"
data['mail_subject'] = "Invitation for " + sur.title
data['mail_subject_existing'] = "Invitation for " + sur.title
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 '''+ self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context) + '''\n\n Thanks,'''
data['mail'] = _('''
Hello %(name)s, \n\n
Please find hereby a survey that we would like you to fill: %s\n
You can access this survey with the following parameters:
Your login ID: %(login)s,\n
Your password: %(passwd)s\n
%s\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):