diff --git a/addons/survey/models/survey_user.py b/addons/survey/models/survey_user.py index f9023a2b868..18b46250644 100644 --- a/addons/survey/models/survey_user.py +++ b/addons/survey/models/survey_user.py @@ -76,7 +76,7 @@ class SurveyUserInput(models.Model): score_percentage = (score_total / total_possible_score) * 100 user_input.scoring_percentage = round(score_percentage, 2) if score_percentage > 0 else 0 - @api.depends('scoring_percentage', 'survey_id.scoring_success_min') + @api.depends('scoring_percentage', 'survey_id') def _compute_scoring_success(self): for user_input in self: user_input.scoring_success = user_input.scoring_percentage >= user_input.survey_id.scoring_success_min diff --git a/addons/survey/tests/test_certification_flow.py b/addons/survey/tests/test_certification_flow.py index e76a0d629d3..367dff9211a 100644 --- a/addons/survey/tests/test_certification_flow.py +++ b/addons/survey/tests/test_certification_flow.py @@ -115,6 +115,10 @@ class TestCertificationFlow(common.TestSurveyCommon, HttpCase): self.assertEqual(user_inputs.scoring_percentage, 87.5) self.assertTrue(user_inputs.scoring_success) + # Check that the certification is still successful even if scoring_success_min of certification is modified + certification.write({'scoring_success_min': 90}) + self.assertTrue(user_inputs.scoring_success) + # Check answer correction is taken into account self.assertNotIn("I think they're great!", user_inputs.mapped('user_input_line_ids.value_text_box')) self.assertIn("Just kidding, I don't like it...", user_inputs.mapped('user_input_line_ids.value_text_box'))