diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-04-03 09:58:57 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-03 12:59:29 +0000 |
| commit | 6cf824933f36cd8111ec61a2bb2da5bb99a2ec6a (patch) | |
| tree | 7e98edf09cbf0dd153a0d58d4e335dcd101ed89b /addons/survey/tests | |
| parent | bea9bc3d6c51bfc1c4eaad2378caba83b7a5142a (diff) | |
[IMP] survey: cascade archive of a survey to its badge
Purpose of this commit is to synchronize active status of certifications to
their badges. When archiving or activating a certification, its badge is also
archived or activated.
Task ID 2170708
Community PR odoo/odoo#46563
Diffstat (limited to 'addons/survey/tests')
| -rw-r--r-- | addons/survey/tests/test_certification_badge.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/survey/tests/test_certification_badge.py b/addons/survey/tests/test_certification_badge.py index 2b7348be427..df31c5e68d9 100644 --- a/addons/survey/tests/test_certification_badge.py +++ b/addons/survey/tests/test_certification_badge.py @@ -8,6 +8,7 @@ from odoo.tools import mute_logger class TestCertificationBadge(common.TestSurveyCommon): + def setUp(self): super(TestCertificationBadge, self).setUp() self.certification_survey = self.env['survey.survey'].with_user(self.survey_manager).create({ @@ -49,6 +50,21 @@ class TestCertificationBadge(common.TestSurveyCommon): 'level': None, }) + def test_archive(self): + """ Archive status of survey is propagated to its badges. """ + self.certification_survey.write({ + 'certification_give_badge': True, + 'certification_badge_id': self.certification_badge.id + }) + + self.certification_survey.action_archive() + self.assertFalse(self.certification_survey.active) + self.assertFalse(self.certification_badge.active) + + self.certification_survey.action_unarchive() + self.assertTrue(self.certification_survey.active) + self.assertTrue(self.certification_badge.active) + def test_give_badge_without_badge(self): with mute_logger('odoo.sql_db'): with self.assertRaises(IntegrityError): |
