summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Mathot (OpenERP) <rim@openerp.com>2014-04-10 16:52:47 +0200
committerRichard Mathot (OpenERP) <rim@openerp.com>2014-04-10 16:52:47 +0200
commitb7989fbeecba1f59de074b51e4e52bbabb87b714 (patch)
treec6f35491d5e846426b40ae1616e6f9e78408df63
parent53ad31c18fbc752bfb9a4206fde19891c6e33aab (diff)
[FIX] Correct saving of comments
bzr revid: rim@openerp.com-20140410145247-o2759q0r022ybp4q
-rw-r--r--addons/survey/survey.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/addons/survey/survey.py b/addons/survey/survey.py
index e2006cfbf3c..35b00a6ef07 100644
--- a/addons/survey/survey.py
+++ b/addons/survey/survey.py
@@ -1148,11 +1148,15 @@ class survey_user_input_line(osv.Model):
self.unlink(cr, uid, old_uil, context=context)
ca = dict_keys_startswith(post, answer_tag)
+ comment_answer = ca.pop(("%s_%s" % (answer_tag, 'comment')), '').strip()
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:
+ if comment_answer:
+ vals.update({'answer_type': 'text', 'value_text': comment_answer})
+ self.create(cr, uid, vals, context=context)
+ if not ca and not comment_answer:
vals.update({'answer_type': None, 'skipped': True})
self.create(cr, uid, vals, context=context)
return True
@@ -1172,8 +1176,14 @@ class survey_user_input_line(osv.Model):
if old_uil:
self.unlink(cr, uid, old_uil, context=context)
- ca = dict_keys_startswith(post, answer_tag)
no_answers = True
+ ca = dict_keys_startswith(post, answer_tag)
+
+ comment_answer = ca.pop(("%s_%s" % (answer_tag, 'comment')), '').strip()
+ if comment_answer:
+ vals.update({'answer_type': 'text', 'value_text': comment_answer})
+ self.create(cr, uid, vals, context=context)
+ no_answers = False
if question.matrix_subtype == 'simple':
for row in question.labels_ids_2: