[FIX] Correct saving of comments

bzr revid: rim@openerp.com-20140410145247-o2759q0r022ybp4q
This commit is contained in:
Richard Mathot (OpenERP) 2014-04-10 16:52:47 +02:00
parent 53ad31c18f
commit b7989fbeec
1 changed files with 12 additions and 2 deletions

View File

@ -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: