diff --git a/survey_skip_start/README.rst b/survey_skip_start/README.rst new file mode 100644 index 00000000..189c761c --- /dev/null +++ b/survey_skip_start/README.rst @@ -0,0 +1,113 @@ +================= +Survey Skip Start +================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:dc405b024372696664f63f37168de6762f260e66fc77df0f079d5a91ec96c2a9 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github + :target: https://github.com/OCA/survey/tree/18.0/survey_skip_start + :alt: OCA/survey +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/survey-18-0/survey-18-0-survey_skip_start + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/survey&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to configure a survey to lead the users directly to +fill the form skipping the start screen. + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +Normally the screen start doesn't provide much value in regular surveys. + +Configuration +============= + +If you want to skip the start screen for a survey: + +1. Go to *Surveys > Surveys* and choose the survey you want to + configure. +2. Go to the *Options* tab and in the *Questions* section set the *Skip + start screen* option on. + +Usage +===== + +Go to a survey which has the *Skip start screen* option set and you'll +be leaded directly to the form. + +Known issues / Roadmap +====================== + +- For the moment, it only works with one page layouts. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__ + + - David Vidal + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-pilarvargas-tecnativa| image:: https://github.com/pilarvargas-tecnativa.png?size=40px + :target: https://github.com/pilarvargas-tecnativa + :alt: pilarvargas-tecnativa + +Current `maintainer `__: + +|maintainer-pilarvargas-tecnativa| + +This module is part of the `OCA/survey `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/survey_skip_start/__init__.py b/survey_skip_start/__init__.py new file mode 100644 index 00000000..91c5580f --- /dev/null +++ b/survey_skip_start/__init__.py @@ -0,0 +1,2 @@ +from . import controllers +from . import models diff --git a/survey_skip_start/__manifest__.py b/survey_skip_start/__manifest__.py new file mode 100644 index 00000000..aec60b9c --- /dev/null +++ b/survey_skip_start/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Survey Skip Start", + "summary": "Skip the surveys start screen and go directly to fill the form", + "version": "18.0.1.0.0", + "development_status": "Beta", + "category": "Marketing/Survey", + "website": "https://github.com/OCA/survey", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["pilarvargas-tecnativa"], + "license": "AGPL-3", + "depends": ["survey"], + "data": [ + "views/survey_survey_views.xml", + ], + "assets": { + "web.assets_tests": [ + "/survey_skip_start/static/tests/survey_skip_start_tour.esm.js", + ], + }, +} diff --git a/survey_skip_start/controllers/__init__.py b/survey_skip_start/controllers/__init__.py new file mode 100644 index 00000000..12a7e529 --- /dev/null +++ b/survey_skip_start/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/survey_skip_start/controllers/main.py b/survey_skip_start/controllers/main.py new file mode 100644 index 00000000..a9ba7f10 --- /dev/null +++ b/survey_skip_start/controllers/main.py @@ -0,0 +1,10 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.addons.survey.controllers.main import Survey + + +class Survey(Survey): + def _prepare_survey_data(self, survey_sudo, answer_sudo, **post): + survey_data = super()._prepare_survey_data(survey_sudo, answer_sudo, **post) + survey_data["skip_start"] = survey_sudo.skip_start + return survey_data diff --git a/survey_skip_start/i18n/es.po b/survey_skip_start/i18n/es.po new file mode 100644 index 00000000..2aac9637 --- /dev/null +++ b/survey_skip_start/i18n/es.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * survey_skip_start +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-17 12:36+0000\n" +"Last-Translator: David Vidal \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: survey_skip_start +#: model:ir.model.fields,field_description:survey_skip_start.field_survey_survey__skip_start +msgid "Skip start screen" +msgstr "Saltar pantalla de inicio" + +#. module: survey_skip_start +#: model:ir.model.fields,help:survey_skip_start.field_survey_survey__skip_start +msgid "Skip the start screen and go directly to the survey form" +msgstr "" +"Saltar la pantalla de inicio e ir directamente al formulario de la encuesta" + +#. module: survey_skip_start +#: model:ir.model,name:survey_skip_start.model_survey_survey +msgid "Survey" +msgstr "Encuesta" + +#, python-format +#~ msgid "The skip start screen option is only compatible with on page layouts" +#~ msgstr "" +#~ "La opción de saltar la pantalla de inicio en la encuesta solo es " +#~ "compatible con los diseños de una sola página" diff --git a/survey_skip_start/i18n/it.po b/survey_skip_start/i18n/it.po new file mode 100644 index 00000000..360797ac --- /dev/null +++ b/survey_skip_start/i18n/it.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * survey_skip_start +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-05-13 09:24+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.10.4\n" + +#. module: survey_skip_start +#: model:ir.model.fields,field_description:survey_skip_start.field_survey_survey__skip_start +msgid "Skip start screen" +msgstr "Salta schermata iniziale" + +#. module: survey_skip_start +#: model:ir.model.fields,help:survey_skip_start.field_survey_survey__skip_start +msgid "Skip the start screen and go directly to the survey form" +msgstr "Salta la schermata iniziale e vai direttamente al modello sondaggio" + +#. module: survey_skip_start +#: model:ir.model,name:survey_skip_start.model_survey_survey +msgid "Survey" +msgstr "Sondaggio" diff --git a/survey_skip_start/i18n/survey_skip_start.pot b/survey_skip_start/i18n/survey_skip_start.pot new file mode 100644 index 00000000..42f04c30 --- /dev/null +++ b/survey_skip_start/i18n/survey_skip_start.pot @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * survey_skip_start +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: survey_skip_start +#: model:ir.model.fields,field_description:survey_skip_start.field_survey_survey__skip_start +msgid "Skip start screen" +msgstr "" + +#. module: survey_skip_start +#: model:ir.model.fields,help:survey_skip_start.field_survey_survey__skip_start +msgid "Skip the start screen and go directly to the survey form" +msgstr "" + +#. module: survey_skip_start +#: model:ir.model,name:survey_skip_start.model_survey_survey +msgid "Survey" +msgstr "" diff --git a/survey_skip_start/models/__init__.py b/survey_skip_start/models/__init__.py new file mode 100644 index 00000000..38d56b98 --- /dev/null +++ b/survey_skip_start/models/__init__.py @@ -0,0 +1 @@ +from . import survey_survey diff --git a/survey_skip_start/models/survey_survey.py b/survey_skip_start/models/survey_survey.py new file mode 100644 index 00000000..05309284 --- /dev/null +++ b/survey_skip_start/models/survey_survey.py @@ -0,0 +1,21 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class SurveySurvey(models.Model): + _inherit = "survey.survey" + + skip_start = fields.Boolean( + string="Skip start screen", + help="Skip the start screen and go directly to the survey form", + ) + + 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( + lambda input: input.survey_id.skip_start and not input.is_session_answer + ).state = "in_progress" + return inputs diff --git a/survey_skip_start/pyproject.toml b/survey_skip_start/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/survey_skip_start/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/survey_skip_start/readme/CONFIGURE.md b/survey_skip_start/readme/CONFIGURE.md new file mode 100644 index 00000000..d3ee4bb8 --- /dev/null +++ b/survey_skip_start/readme/CONFIGURE.md @@ -0,0 +1,5 @@ +If you want to skip the start screen for a survey: + +1. Go to *Surveys > Surveys* and choose the survey you want to configure. +2. Go to the *Options* tab and in the *Questions* section set the *Skip start screen* + option on. diff --git a/survey_skip_start/readme/CONTEXT.md b/survey_skip_start/readme/CONTEXT.md new file mode 100644 index 00000000..bb9f5d9d --- /dev/null +++ b/survey_skip_start/readme/CONTEXT.md @@ -0,0 +1 @@ +Normally the screen start doesn't provide much value in regular surveys. diff --git a/survey_skip_start/readme/CONTRIBUTORS.md b/survey_skip_start/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..59e234a1 --- /dev/null +++ b/survey_skip_start/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Tecnativa](https://www.tecnativa.com) + + - David Vidal diff --git a/survey_skip_start/readme/DESCRIPTION.md b/survey_skip_start/readme/DESCRIPTION.md new file mode 100644 index 00000000..947ea8d3 --- /dev/null +++ b/survey_skip_start/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows to configure a survey to lead the users directly to fill the form +skipping the start screen. diff --git a/survey_skip_start/readme/ROADMAP.md b/survey_skip_start/readme/ROADMAP.md new file mode 100644 index 00000000..990e14e8 --- /dev/null +++ b/survey_skip_start/readme/ROADMAP.md @@ -0,0 +1 @@ +- For the moment, it only works with one page layouts. diff --git a/survey_skip_start/readme/USAGE.md b/survey_skip_start/readme/USAGE.md new file mode 100644 index 00000000..8309e785 --- /dev/null +++ b/survey_skip_start/readme/USAGE.md @@ -0,0 +1,2 @@ +Go to a survey which has the *Skip start screen* option set and you'll be leaded +directly to the form. diff --git a/survey_skip_start/static/description/icon.png b/survey_skip_start/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/survey_skip_start/static/description/icon.png differ diff --git a/survey_skip_start/static/description/index.html b/survey_skip_start/static/description/index.html new file mode 100644 index 00000000..ed8635a0 --- /dev/null +++ b/survey_skip_start/static/description/index.html @@ -0,0 +1,458 @@ + + + + + +Survey Skip Start + + + +
+

Survey Skip Start

+ + +

Beta License: AGPL-3 OCA/survey Translate me on Weblate Try me on Runboat

+

This module allows to configure a survey to lead the users directly to +fill the form skipping the start screen.

+

Table of contents

+ +
+

Use Cases / Context

+

Normally the screen start doesn’t provide much value in regular surveys.

+
+
+

Configuration

+

If you want to skip the start screen for a survey:

+
    +
  1. Go to Surveys > Surveys and choose the survey you want to +configure.
  2. +
  3. Go to the Options tab and in the Questions section set the Skip +start screen option on.
  4. +
+
+
+

Usage

+

Go to a survey which has the Skip start screen option set and you’ll +be leaded directly to the form.

+
+
+

Known issues / Roadmap

+
    +
  • For the moment, it only works with one page layouts.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

pilarvargas-tecnativa

+

This module is part of the OCA/survey project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/survey_skip_start/static/tests/survey_skip_start_tour.esm.js b/survey_skip_start/static/tests/survey_skip_start_tour.esm.js new file mode 100644 index 00000000..21c653a6 --- /dev/null +++ b/survey_skip_start/static/tests/survey_skip_start_tour.esm.js @@ -0,0 +1,13 @@ +/** @odoo-module **/ + +import {registry} from "@web/core/registry"; + +registry.category("web_tour.tours").add("test_survey_skip_start", { + steps: () => [ + { + content: "Answer Where do you live", + trigger: 'div.js_question-wrapper:contains("Where do you live") input', + run: "fill Spain", + }, + ], +}); diff --git a/survey_skip_start/tests/__init__.py b/survey_skip_start/tests/__init__.py new file mode 100644 index 00000000..7533e018 --- /dev/null +++ b/survey_skip_start/tests/__init__.py @@ -0,0 +1 @@ +from . import test_survey_skip_start diff --git a/survey_skip_start/tests/test_survey_skip_start.py b/survey_skip_start/tests/test_survey_skip_start.py new file mode 100644 index 00000000..90a80671 --- /dev/null +++ b/survey_skip_start/tests/test_survey_skip_start.py @@ -0,0 +1,21 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.tests import HttpCase, tagged + + +@tagged("-at_install", "post_install") +class SurveySkipStartCase(HttpCase): + def setUp(self): + """We run the tour in the setup so we can share the tests case with other + modules""" + super().setUp() + self.survey = self.env.ref("survey.survey_feedback") + + def test_skip_survey_start_screen(self): + """Skip the start screen""" + self.survey.skip_start = True + self.start_tour( + f"/survey/start/{self.survey.access_token}", + "test_survey_skip_start", + step_delay=1000, + ) diff --git a/survey_skip_start/views/survey_survey_views.xml b/survey_skip_start/views/survey_survey_views.xml new file mode 100644 index 00000000..fabaaff7 --- /dev/null +++ b/survey_skip_start/views/survey_survey_views.xml @@ -0,0 +1,12 @@ + + + + survey.survey + + + + + + + +