[IMP] Saving for multichoice
bzr revid: rim@openerp.com-20131218161419-87uoetuci4okc2qw
This commit is contained in:
+24
-1
@@ -1066,8 +1066,31 @@ class survey_user_input_line(osv.osv):
|
||||
self.create(cr, uid, vals, context=context)
|
||||
return True
|
||||
|
||||
def save_line_multiple_choice(self, cr, uid, user_input_id, question, post, answer_tag, context=None):
|
||||
vals = {
|
||||
'user_input_id': user_input_id,
|
||||
'question_id': question.id,
|
||||
'page_id': question.page_id.id,
|
||||
'survey_id': question.survey_id.id,
|
||||
'skipped': False
|
||||
}
|
||||
old_uil = self.search(cr, uid, [('user_input_id', '=', user_input_id),
|
||||
('survey_id', '=', question.survey_id.id),
|
||||
('question_id', '=', question.id)],
|
||||
context=context)
|
||||
if old_uil:
|
||||
self.unlink(cr, uid, old_uil, context=context)
|
||||
|
||||
ca = dict_keys_startswith(post, answer_tag)
|
||||
if len(ca) > 0:
|
||||
for a in ca:
|
||||
vals.update({'answer_type': 'suggestion', 'value_suggested': ca[a]})
|
||||
self.create(cr, uid, vals, context=context)
|
||||
else:
|
||||
vals.update({'answer_type': None, 'skipped': True})
|
||||
self.create(cr, uid, vals, context=context)
|
||||
return True
|
||||
|
||||
# def save_line_multiple_choice:
|
||||
|
||||
def dict_keys_startswith(dictionary, string):
|
||||
'''Returns a dictionary containing the elements of <dict> whose keys start
|
||||
|
||||
@@ -122,10 +122,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Survey" version="7.0">
|
||||
<header groups="base.group_survey_manager">
|
||||
<button name="action_edit_survey" states="draft" string="Edit Survey" type="object" class="oe_highlight"/>
|
||||
<!-- <button name="action_edit_survey" states="draft" string="Edit Survey" type="object" class="oe_highlight"/>
|
||||
<button name="survey_cancel" string="Cancel" states="draft" type="object"/>
|
||||
<button name="action_send_survey" string="Invite people" states="open" type="object" class="oe_highlight"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,close,cancelled" clickable="True"/>
|
||||
--> <field name="state" widget="statusbar" statusbar_visible="draft,open,close,cancelled" clickable="True"/>
|
||||
</header>
|
||||
<sheet class="oe_survey">
|
||||
<div class="oe_button_box oe_right" groups="base.group_survey_manager">
|
||||
|
||||
Reference in New Issue
Block a user