Skip to content

Commit

Permalink
Merge PR #108 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jan 19, 2024
2 parents 74ee029 + 3dacf26 commit 7dc7f72
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 40 deletions.
2 changes: 1 addition & 1 deletion survey_skip_start/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Survey Skip Start
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2fcfa0f62dcc2455eb925c373fb343703fe10b2f4c258a862e574c364703c10a
!! source digest: sha256:a956d580fd7052fa88bee70350c6fb86ab4ae56f504c3908a11d44b7d5dc7f0c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
1 change: 0 additions & 1 deletion survey_skip_start/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"depends": ["survey"],
"data": [
"views/survey_survey_views.xml",
"views/survey_templates.xml",
],
"assets": {
"web.assets_tests": [
Expand Down
19 changes: 7 additions & 12 deletions survey_skip_start/models/survey_survey.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo import fields, models


class SurveySurvey(models.Model):
Expand All @@ -12,13 +11,9 @@ class SurveySurvey(models.Model):
help="Skip the start screen and go directly to the survey form",
)

@api.constrains("skip_start")
def _constrain_skip_start(self):
"""For the moment, skipping the start screen is only compatible with single
page layout surveys"""
if self.filtered(lambda x: x.skip_start and x.questions_layout != "one_page"):
raise UserError(
_(
"The skip start screen option is only compatible with on page layouts"
)
)
def _create_answer(self, *args, **additional_vals):
"""The survey template checks the state of the inputs to show the start screen
or not. Setting the state we go directly to the form"""
inputs = super()._create_answer(*args, **additional_vals)
inputs.filtered("survey_id.skip_start").state = "in_progress"
return inputs
2 changes: 1 addition & 1 deletion survey_skip_start/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Survey Skip Start</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2fcfa0f62dcc2455eb925c373fb343703fe10b2f4c258a862e574c364703c10a
!! source digest: sha256:a956d580fd7052fa88bee70350c6fb86ab4ae56f504c3908a11d44b7d5dc7f0c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/survey/tree/15.0/survey_skip_start"><img alt="OCA/survey" src="https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_skip_start"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/survey&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to configure a survey to lead the users directly to
Expand Down
8 changes: 0 additions & 8 deletions survey_skip_start/tests/test_survey_skip_start.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.exceptions import UserError
from odoo.tests import HttpCase, tagged


Expand All @@ -11,7 +10,6 @@ def setUp(self):
modules"""
super().setUp()
self.survey = self.env.ref("survey.survey_feedback")
self.survey.questions_layout = "page_per_section"

def test_dont_skip_survey_start_screen(self):
"""Test the default behavior"""
Expand All @@ -22,14 +20,8 @@ def test_dont_skip_survey_start_screen(self):

def test_skip_survey_start_screen(self):
"""Skip the start screen"""
self.survey.questions_layout = "one_page"
self.survey.skip_start = True
self.start_tour(
f"/survey/start/{self.survey.access_token}",
"test_survey_skip_start",
)

def test_skip_survey_start_screen_constraints(self):
self.survey.questions_layout = "page_per_section"
with self.assertRaises(UserError):
self.survey.skip_start = True
17 changes: 0 additions & 17 deletions survey_skip_start/views/survey_templates.xml

This file was deleted.

0 comments on commit 7dc7f72

Please sign in to comment.