[IMP] survey: log message
bzr revid: chm@openerp.com-20130227140854-art7r4qxjf2vrdll
This commit is contained in:
@@ -344,7 +344,7 @@ class survey_question(osv.osv):
|
||||
'minimum_req_ans': fields.integer('Minimum Required Answer'),
|
||||
'req_error_msg': fields.text('Error Message', translate=True),
|
||||
'allow_comment': fields.boolean('Allow Comment Field'),
|
||||
'sequence': fields.integer('Sequence', select=True),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
'tot_resp': fields.function(_calc_response, string="Total Answer"),
|
||||
'survey': fields.related('page_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
|
||||
'descriptive_text': fields.text('Descriptive Text', size=255, translate=True),
|
||||
@@ -626,7 +626,7 @@ class survey_answer(osv.osv):
|
||||
_columns = {
|
||||
'question_id': fields.many2one('survey.question', 'Question', ondelete='cascade'),
|
||||
'answer': fields.char('Answer', size=128, required=1, translate=True),
|
||||
'sequence': fields.integer('Sequence', select=True),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
'response': fields.function(_calc_response_avg, string="#Answer", multi='sums'),
|
||||
'average': fields.function(_calc_response_avg, string="#Avg", multi='sums'),
|
||||
'type': fields.selection([('char', 'Character'), ('date', 'Date'), ('datetime', 'Date & Time'), \
|
||||
|
||||
@@ -178,13 +178,13 @@ class survey_question_wiz(osv.osv_memory):
|
||||
def _survey_complete(self, cr, uid, survey_id, context):
|
||||
""" list of action to do when the survey is completed
|
||||
"""
|
||||
# send mail to the responsible
|
||||
user_browse = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context=context)
|
||||
val = {
|
||||
'type': 'notification',
|
||||
'model': 'survey',
|
||||
'res_id': survey_id,
|
||||
'record_name': _("Survey N° %s") % survey_id,
|
||||
'body': _("New response on this survey."),
|
||||
'body': _("%s have post a new response on this survey.") % user_browse.name,
|
||||
}
|
||||
self.pool.get('survey').message_post(cr, SUPERUSER_ID, survey_id, context=context, **val)
|
||||
|
||||
@@ -1158,7 +1158,6 @@ class survey_question_wiz(osv.osv_memory):
|
||||
response_id = sur_name_read['response_id'][0]
|
||||
|
||||
self.pool.get('survey.response').write(cr, SUPERUSER_ID, [response_id], {'state': 'done'})
|
||||
self._survey_complete(cr, uid, context['survey_id'], context)
|
||||
|
||||
ir_model_data = self.pool.get('ir.model.data')
|
||||
user_browse = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context=context)
|
||||
@@ -1169,6 +1168,8 @@ class survey_question_wiz(osv.osv_memory):
|
||||
else:
|
||||
model, view_id = ir_model_data.get_object_reference(cr, uid, 'survey', 'view_survey_complete_survey')
|
||||
|
||||
self._survey_complete(cr, uid, context['survey_id'], context)
|
||||
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
|
||||
Reference in New Issue
Block a user