[MERGE] lp:914264 (survey: fix view when answering a survey)
bzr revid: rco@openerp.com-20120124150053-9t8gi0hhcsyxp0jv
This commit is contained in:
commit
f8d582e029
|
@ -22,12 +22,13 @@
|
|||
from osv import osv
|
||||
from osv import fields
|
||||
from tools.translate import _
|
||||
from lxml import etree
|
||||
|
||||
class survey_name_wiz(osv.osv_memory):
|
||||
_name = 'survey.name.wiz'
|
||||
|
||||
_columns = {
|
||||
'survey_id': fields.many2one('survey', 'Survey', required=True, ondelete='cascade'),
|
||||
'survey_id': fields.many2one('survey', 'Survey', required=True, ondelete='cascade', domain= [('state', '=', 'open')]),
|
||||
'page_no': fields.integer('Page Number'),
|
||||
'note': fields.text("Description"),
|
||||
'page': fields.char('Page Position',size = 12),
|
||||
|
@ -44,6 +45,19 @@ class survey_name_wiz(osv.osv_memory):
|
|||
'store_ans': '{}' #Setting the default pattern as '{}' as the field is of type text. The field always gets the value in dict format
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
if uid != 1:
|
||||
survey_obj = self.pool.get('survey')
|
||||
line_ids = survey_obj.search(cr, uid, [('invited_user_ids','in',uid)], context=context)
|
||||
domain = str([('id', 'in', line_ids)])
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='survey_id']")
|
||||
for node in nodes:
|
||||
node.set('domain', domain)
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Start the survey, Increment in started survey field but if set the max_response_limit of
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
<separator colspan="4" string="Select Survey" />
|
||||
<newline />
|
||||
<field name="survey_id" colspan="4"
|
||||
on_change="on_change_survey(survey_id)" width="250"
|
||||
domain="[('state','=','open')]"/>
|
||||
on_change="on_change_survey(survey_id)" width="250"/>
|
||||
<group col="1" colspan="4"
|
||||
attrs="{'readonly': [('survey_id','=',False)]}">
|
||||
<separator colspan="4" string="Survey Details" />
|
||||
|
|
Loading…
Reference in New Issue