From 76621a0b2428522f99fd7b0a69782472967d6794 Mon Sep 17 00:00:00 2001 From: "Richard Mathot (OpenERP)" Date: Wed, 9 Apr 2014 16:42:24 +0200 Subject: [PATCH] [FIX] validation system: the last things bzr revid: rim@openerp.com-20140409144224-6b00mnmihe8t1ii7 --- addons/survey/survey.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 37ba2e1fa74..a4c2a6bb987 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -767,6 +767,7 @@ class survey_question(osv.Model): if question.constr_mandatory: lines_number = len(question.labels_ids_2) answer_candidates = dict_keys_startswith(post, answer_tag) + comment_answer = answer_candidates.pop(("%s_%s" % (answer_tag, 'comment')), '').strip() # Number of lines that have been answered if question.matrix_subtype == 'simple': answer_number = len(answer_candidates) @@ -774,6 +775,9 @@ class survey_question(osv.Model): answer_number = len(set([sk.rsplit('_', 1)[0] for sk in answer_candidates.keys()])) else: raise RuntimeError("Invalid matrix subtype") + # Validate that each line has been answered + if answer_number != lines_number: + errors.update({answer_tag: question.constr_error_msg}) return errors