Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions survey_legal/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
==================
Survey legal terms
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4d4b831684deeca6836a2d86ecda348f6a934af3bceee158e053fe8f08ff1c22
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/17.0/survey_legal
:alt: OCA/survey
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/survey-17-0/survey-17-0-survey_legal
: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=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows you to include a legal terms acceptance checkbox in
your surveys. You have the ability to customize this feature for each
individual survey.

**Table of contents**

.. contents::
:local:

Configuration
=============

To require legal terms acceptance in a survey, follow these steps:

1. Go to to *Surveys* and select the survey you want to edit.
2. Go to the *Options* tab and check the *Requier legal terms
acceptance* checkbox.
3. Configure your desired legal terms link and text.

The users of the survey will be required to accept the legal terms
before they can submit their answers to the questions.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/survey/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 <https://github.com/OCA/survey/issues/new?body=module:%20survey_legal%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__

- David Vidal
- Pilar Vargas

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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-pilarvargas-tecnativa|

This module is part of the `OCA/survey <https://github.com/OCA/survey/tree/17.0/survey_legal>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions survey_legal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
25 changes: 25 additions & 0 deletions survey_legal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2022 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Survey legal terms",
"summary": "Require legal terms before survey submit",
"version": "17.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_views.xml",
"views/survey_templates.xml",
"views/survey_user_input_views.xml",
],
"assets": {
"survey.survey_assets": ["survey_legal/static/src/js/*"],
"web.assets_tests": [
"survey_legal/static/tests/*",
],
},
}
1 change: 1 addition & 0 deletions survey_legal/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
28 changes: 28 additions & 0 deletions survey_legal/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.http import request, route

from odoo.addons.survey.controllers.main import Survey


class SurveyMetada(Survey):
@route()
def survey_submit(self, survey_token, answer_token, **post):
"""The acceptance of the legal terms has the user's footprint warranty"""
res = super().survey_submit(survey_token, answer_token, **post)
access_data = self._get_access_data(
survey_token, answer_token, ensure_token=True
)
if access_data["validity_code"] is not True:
return res

Check warning on line 17 in survey_legal/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

survey_legal/controllers/main.py#L17

Added line #L17 was not covered by tests
answer_sudo = access_data["answer_sudo"]
if not answer_sudo.survey_id.legal_terms:
return res
environ = request.httprequest.headers.environ
answer_sudo.user_metadata = (
f"IP: {environ.get('REMOTE_ADDR')}\n"
f"USER_AGENT: {environ.get('HTTP_USER_AGENT')}\n"
f"ACCEPT_LANGUAGE: {environ.get('HTTP_ACCEPT_LANGUAGE')}\n"
f"REFERER: {environ.get('HTTP_REFERER')}\n"
)
return res
71 changes: 71 additions & 0 deletions survey_legal/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_legal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-11 18:37+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms_link
msgid "Legal Terms Link"
msgstr "Enlace a los Términos Legales"

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms_text
msgid "Legal Terms Text"
msgstr "Texto de los Términos Legales"

#. module: survey_legal
#: model:ir.model.fields,help:survey_legal.field_survey_user_input__user_metadata
msgid ""
"Metadata gathered during survey validation when legal terms are enabled"
msgstr ""
"Metadatos recopilados durante la validación de la encuesta cuando se activan "
"los términos legales"

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms
msgid "Require legal terms acceptance"
msgstr "Exigir la aceptación de los términos legales"

#. module: survey_legal
#: model:ir.model,name:survey_legal.model_survey_survey
msgid "Survey"
msgstr "Encuesta"

#. module: survey_legal
#: model:ir.model,name:survey_legal.model_survey_user_input
msgid "Survey User Input"
msgstr "Entrada de usuario de la encuesta"

#. module: survey_legal
#: model:ir.model.fields,help:survey_legal.field_survey_survey__legal_terms
msgid ""
"The users will be prompted to require the acceptance of the legal terms to "
"be able to submit their answers"
msgstr ""
"Se pedirá a los usuarios que acepten los términos legales para poder enviar "
"sus respuestas"

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_user_input__user_metadata
msgid "User Metadata"
msgstr "Metadatos de Usuario"

#. module: survey_legal
#. openerp-web
#: code:addons/survey_legal/static/src/js/survey_form.esm.js:0
#, python-format
msgid "You must accept the legal terms"
msgstr "Debe aceptar las condiciones legales"
71 changes: 71 additions & 0 deletions survey_legal/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_legal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-29 09:13+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 4.17\n"

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms_link
msgid "Legal Terms Link"
msgstr "Collegamento termini legali"

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms_text
msgid "Legal Terms Text"
msgstr "Testo termini legali"

#. module: survey_legal
#: model:ir.model.fields,help:survey_legal.field_survey_user_input__user_metadata
msgid ""
"Metadata gathered during survey validation when legal terms are enabled"
msgstr ""
"Metadati ottenuti nella validazione sondaggio quando i termini legali sono "
"abilitati"

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms
msgid "Require legal terms acceptance"
msgstr "Richiede l'accettazione dei termini legali"

#. module: survey_legal
#: model:ir.model,name:survey_legal.model_survey_survey
msgid "Survey"
msgstr "Sondaggio"

#. module: survey_legal
#: model:ir.model,name:survey_legal.model_survey_user_input
msgid "Survey User Input"
msgstr "Risposta utente al sondaggio"

#. module: survey_legal
#: model:ir.model.fields,help:survey_legal.field_survey_survey__legal_terms
msgid ""
"The users will be prompted to require the acceptance of the legal terms to "
"be able to submit their answers"
msgstr ""
"All'utente verrà richiesto di accettare i temini legali per poter rispondere "
"alle domande"

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_user_input__user_metadata
msgid "User Metadata"
msgstr "Metadati utente"

#. module: survey_legal
#. openerp-web
#: code:addons/survey_legal/static/src/js/survey_form.esm.js:0
#, python-format
msgid "You must accept the legal terms"
msgstr "Bisogna accettare i temini legali"
64 changes: 64 additions & 0 deletions survey_legal/i18n/survey_legal.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_legal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms_link
msgid "Legal Terms Link"
msgstr ""

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms_text
msgid "Legal Terms Text"
msgstr ""

#. module: survey_legal
#: model:ir.model.fields,help:survey_legal.field_survey_user_input__user_metadata
msgid ""
"Metadata gathered during survey validation when legal terms are enabled"
msgstr ""

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_survey__legal_terms
msgid "Require legal terms acceptance"
msgstr ""

#. module: survey_legal
#: model:ir.model,name:survey_legal.model_survey_survey
msgid "Survey"
msgstr ""

#. module: survey_legal
#: model:ir.model,name:survey_legal.model_survey_user_input
msgid "Survey User Input"
msgstr ""

#. module: survey_legal
#: model:ir.model.fields,help:survey_legal.field_survey_survey__legal_terms
msgid ""
"The users will be prompted to require the acceptance of the legal terms to "
"be able to submit their answers"
msgstr ""

#. module: survey_legal
#: model:ir.model.fields,field_description:survey_legal.field_survey_user_input__user_metadata
msgid "User Metadata"
msgstr ""

#. module: survey_legal
#. openerp-web
#: code:addons/survey_legal/static/src/js/survey_form.esm.js:0
#, python-format
msgid "You must accept the legal terms"
msgstr ""
2 changes: 2 additions & 0 deletions survey_legal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import survey
from . import survey_user_input
17 changes: 17 additions & 0 deletions survey_legal/models/survey.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2022 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"

legal_terms = fields.Boolean(
string="Require legal terms acceptance",
help="The users will be prompted to require the acceptance of the legal terms "
"to be able to submit their answers",
)
legal_terms_link = fields.Char(default="/terms")
legal_terms_text = fields.Text(
default="I accept the legal terms, the privacy policy and conditions."
)
Loading