From 70a531e0700b789686c2b59587b53fa7ffe455d3 Mon Sep 17 00:00:00 2001 From: "Richard Mathot (OpenERP)" Date: Wed, 22 Jan 2014 10:45:16 +0100 Subject: [PATCH] [FIX] Bug in MCQ validation bzr revid: rim@openerp.com-20140122094516-1hvfqrirqmxmdktx --- addons/survey/survey.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/survey/survey.py b/addons/survey/survey.py index a9f78d46167..1ad557c3760 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -581,9 +581,10 @@ class survey_question(osv.Model): if question.constr_mandatory: answer_candidates = dict_keys_startswith(post, answer_tag) comment_flag = answer_candidates.pop(("%s_%s" % (answer_tag, -1)), None) - comment_answer = answer_candidates.pop(("%s_%s" % (answer_tag, question.comment_children_ids[0].id)), '').strip() + if question.comments_allowed: + comment_answer = answer_candidates.pop(("%s_%s" % (answer_tag, question.comment_children_ids[0].id)), '').strip() # There is no answer neither comments (if comments count as answer) - if not answer_candidates and question.comment_count_as_answer and comment_flag and comment_answer == '': + if not answer_candidates and question.comment_count_as_answer and comment_flag and comment_answer: errors.update({answer_tag: question.constr_error_msg}) # There is no answer at all if not answer_candidates and not comment_flag: