[FIX] survey: fix test failing for duplicated session_code

Surveys cannot be created in batch without `session_code` because it must
be unique across surveys.

Technically, using a 5-digit codes makes it unlikely that
a collision occurs with records created without explicit session_code (see
Survey._get_default_session_code's iterative process).

See runbot 55709
See also related runbot 25041 solved in #159295

Task-3829536

closes odoo/odoo#162587

X-original-commit: 0efbd6e31f5870c1e3004c129e79b9dfa7379863
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Florian Charlier
2024-04-24 07:55:43 +00:00
parent 977ae7d33a
commit f95cff0836
+2 -2
View File
@@ -15,8 +15,8 @@ class TestSurveyInternals(common.TestSurveyCommon, MailCase):
def test_allowed_triggering_question_ids(self):
# Create 2 surveys, each with 3 questions, each with 2 suggested answers
survey_1, survey_2 = self.env['survey.survey'].create([
{'title': 'Test Survey 1'},
{'title': 'Test Survey 2'}
{'title': 'Test Survey 1', 'session_code': '10000'},
{'title': 'Test Survey 2', 'session_code': '10001'}
])
self.env['survey.question'].create([
{