from tools.translate import _
from time import strftime
-import datetime
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
import copy
-from mx.DateTime import *
import os
class survey_type(osv.osv):
'page_ids': fields.one2many('survey.page', 'survey_id', 'Page'),
'date_open': fields.datetime('Survey Open Date', readonly=1),
'date_close': fields.datetime('Survey Close Date', readonly=1),
- 'max_response_limit': fields.integer('Maximum Answer Limit'),
+ 'max_response_limit': fields.integer('Maximum Answer Limit',
+ help="Set to one if survey is answerable only once"),
'response_user': fields.integer('Maximum Answer per User',
help="Set to one if you require only one Answer per user"),
'state': fields.selection([('draft', 'Draft'), ('open', 'Open'), ('close', 'Closed'), ('cancel', 'Cancelled')], 'Status', readonly=True),
- 'responsible_id': fields.many2one('res.users', 'Responsible'),
+ 'responsible_id': fields.many2one('res.users', 'Responsible', help="User responsible for survey"),
'tot_start_survey': fields.integer("Total Started Survey", readonly=1),
'tot_comp_survey': fields.integer("Total Completed Survey", readonly=1),
'note': fields.text('Description', size=128),
'users': fields.many2many('res.users', 'survey_users_rel', 'sid', 'uid', 'Users'),
'send_response': fields.boolean('E-mail Notification on Answer'),
'type': fields.many2one('survey.type', 'Type'),
+ 'invited_user_ids': fields.many2many('res.users', 'survey_invited_user_rel', 'sid', 'uid', 'Invited User'),
}
_defaults = {
'state': lambda * a: "draft",
'type': 'ir.actions.report.xml',
'report_name': 'survey.browse.response',
'datas': datas,
- 'nodestroy': True,
- 'context' : context
+ 'context' : context,
+ 'nodestroy':True,
}
else:
'type': 'ir.actions.report.xml',
'report_name': 'survey.form',
'datas': datas,
+ 'context' : context,
'nodestroy':True,
- 'context' : context
}
return report
survey()
return {}
val = {}
cr.execute("select question_id, count(id) as Total_response from \
- survey_response_line where state='done' and question_id in (%s)\
- group by question_id" % ",".join(map(str, map(int, ids))))
+ survey_response_line where state='done' and question_id IN %s\
+ group by question_id" ,(tuple(ids),))
ids1 = copy.deepcopy(ids)
for rec in cr.fetchall():
ids1.remove(rec[0])
'in_visible_answer_type': fields.boolean('Is Answer Type Invisible??')
}
_defaults = {
- 'sequence' : lambda * a: 1,
+# 'sequence' : lambda * a: 1,
'type' : lambda * a: 'char',
'in_visible_answer_type':_get_in_visible_answer_type,
}
}
_defaults = {
'state': lambda * a: 'draft',
- 'date_deadline': lambda * a : (now() + RelativeDateTime(months=+1)).strftime("%Y-%m-%d %H:%M:%S")
+# 'date_deadline': lambda * a : (datetime.now() + relativedelta(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'})