Skip to content

Commit

Permalink
Merge PR #145 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jan 28, 2025
2 parents 96d2f4d + 1ed5639 commit edc5938
Show file tree
Hide file tree
Showing 29 changed files with 1,256 additions and 0 deletions.
117 changes: 117 additions & 0 deletions survey_partner_representative/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
=============================
Survey Partner Representative
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:32924103c7ee99139f60cb1d89ae02a2085ced8d944a379da91f5d3a2426cf11
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_partner_representative
: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_partner_representative
: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|

Do surveys on behalf of others.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

When we have the modules ``survey_contact_generation``,
``survey_sale_generation`` or ``survey_crm_generation`` a salesman or a
portal users could want to act as a representative of another using the
surveys that generate those documents as an entry point.

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

Users that can make surveys on behalf of others need to have the
*Representative on surveys* special permission.

If you want to allow that a survey is filled on behalf of others by the
authorized users:

1. Go to *Surveys > Surveys* and choose the survey you want to
configure.
2. Go to the *Options* tab and in the *Participants* section set the
*Allow Partner Representing* option on.

Usage
=====

A user acting on behalf of other can start a new survey from the share
link:

- On the survey backend form, click on *Share* and copy the survey URL.
- Paste it in your browser and fill the survey with needed data.

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_partner_representative%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

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-chienandalu| image:: https://github.com/chienandalu.png?size=40px
:target: https://github.com/chienandalu
:alt: chienandalu

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-chienandalu|

This module is part of the `OCA/survey <https://github.com/OCA/survey/tree/17.0/survey_partner_representative>`_ 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_partner_representative/__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_partner_representative/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Survey Partner Representative",
"summary": "Fill the survey on behalf of others",
"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": ["chienandalu"],
"license": "AGPL-3",
"depends": ["survey"],
"data": [
"security/survey_partner_representative_security.xml",
"views/survey_survey_views.xml",
"views/survey_user_input_views.xml",
],
"demo": ["demo/survey_partner_representative_demo.xml"],
"assets": {
"web.assets_tests": [
"/survey_partner_representative/static/tests/survey_representative_tour.esm.js",
],
},
}
1 change: 1 addition & 0 deletions survey_partner_representative/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
22 changes: 22 additions & 0 deletions survey_partner_representative/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.http import request

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


class Survey(Survey):
def _check_validity(
self, survey_token, answer_token, ensure_token=True, check_partner=True
):
# Avoid partner mismatching error
survey_sudo, _answer_sudo = self._fetch_from_access_token(
survey_token, answer_token
)
if survey_sudo.allow_partner_representing and request.env.user.has_group(
"survey_partner_representative.partner_representative"
):
check_partner = False
return super()._check_validity(
survey_token, answer_token, ensure_token, check_partner
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="survey.survey" id="survey_representative_demo">
<field name="title">Meal preferences</field>
<field name="access_token">80e5f1e2-1a9d-4c51-8e23-4abc7534</field>
<field name="access_mode">public</field>
<field name="users_can_go_back" eval="True" />
</record>
<record model="survey.question" id="survey_representative_q0">
<field name="survey_id" ref="survey_representative_demo" />
<field name="sequence">0</field>
<field name="title">Name</field>
<field name="question_type">char_box</field>
<field name="constr_mandatory" eval="True" />
</record>
<record model="survey.question" id="survey_representative_q1">
<field name="survey_id" ref="survey_representative_demo" />
<field name="sequence">1</field>
<field name="title">Email</field>
<field name="question_type">char_box</field>
</record>
<record model="survey.question" id="survey_representative_q5">
<field name="survey_id" ref="survey_representative_demo" />
<field name="sequence">4</field>
<field name="title">What would you like for dinner?</field>
<field name="question_type">simple_choice</field>
</record>
<record model="survey.question.answer" id="survey_representative_q5_sug1">
<field name="question_id" ref="survey_representative_q5" />
<field name="sequence">1</field>
<field name="value">Meat</field>
</record>
<record model="survey.question.answer" id="survey_representative_q5_sug2">
<field name="question_id" ref="survey_representative_q5" />
<field name="sequence">2</field>
<field name="value">Fish</field>
</record>
<record model="survey.question.answer" id="survey_representative_q5_sug3">
<field name="question_id" ref="survey_representative_q5" />
<field name="sequence">3</field>
<field name="value">Vegan</field>
</record>
</odoo>
122 changes: 122 additions & 0 deletions survey_partner_representative/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_partner_representative
#
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 <[email protected]>\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_partner_representative
#: model:ir.model.fields,help:survey_partner_representative.field_survey_survey__allow_partner_representing
msgid ""
"A user with the proper permissions, could do the survey on behalf of other"
msgstr ""
"Un usuario con los permisos pertinentes puede hacer la encuesta por otro"

#. module: survey_partner_representative
#: model:ir.model.fields,field_description:survey_partner_representative.field_survey_survey__allow_partner_representing
msgid "Allow Partner Representing"
msgstr "Permitir representación de contacto"

#. module: survey_partner_representative
#: model:survey.question,title:survey_partner_representative.survey_representative_q1
msgid "Email"
msgstr "Correo electrónico"

#. module: survey_partner_representative
#: model:survey.question.answer,value:survey_partner_representative.survey_representative_q5_sug2
msgid "Fish"
msgstr "Pescado"

#. module: survey_partner_representative
#: model:survey.question,comments_message:survey_partner_representative.survey_representative_q0
#: model:survey.question,comments_message:survey_partner_representative.survey_representative_q1
#: model:survey.question,comments_message:survey_partner_representative.survey_representative_q5
msgid "If other, please specify:"
msgstr "Si es otra, especifique por favor:"

#. module: survey_partner_representative
#: model:survey.survey,title:survey_partner_representative.survey_representative_demo
msgid "Meal preferences"
msgstr "Preferencias para la comida"

#. module: survey_partner_representative
#: model:survey.question.answer,value:survey_partner_representative.survey_representative_q5_sug1
msgid "Meat"
msgstr "Carne"

#. module: survey_partner_representative
#: model:survey.question,title:survey_partner_representative.survey_representative_q0
msgid "Name"
msgstr "Nombre"

#. module: survey_partner_representative
#: model:ir.model.fields,field_description:survey_partner_representative.field_survey_user_input__representative_partner_id
msgid "Representative Partner"
msgstr "Contacto representante"

#. module: survey_partner_representative
#: model:res.groups,name:survey_partner_representative.partner_representative
msgid "Representative on surveys"
msgstr "Representante en encuestas"

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

#. module: survey_partner_representative
#: model:ir.model.fields,field_description:survey_partner_representative.field_survey_representative_mixin__survey_representative_partner_id
msgid "Survey Representative Partner"
msgstr "Contacto representante en la encuesta"

#. module: survey_partner_representative
#: model:ir.model,name:survey_partner_representative.model_survey_user_input
#: model:ir.model.fields,field_description:survey_partner_representative.field_survey_representative_mixin__survey_user_input_id
msgid "Survey User Input"
msgstr "Respuesta de usuario"

#. module: survey_partner_representative
#: model:survey.question,validation_error_msg:survey_partner_representative.survey_representative_q0
#: model:survey.question,validation_error_msg:survey_partner_representative.survey_representative_q1
#: model:survey.question,validation_error_msg:survey_partner_representative.survey_representative_q5
msgid "The answer you entered is not valid."
msgstr "La respuesta que ha introducido no es válida."

#. module: survey_partner_representative
#: model:ir.model.fields,help:survey_partner_representative.field_survey_user_input__representative_partner_id
msgid "This partner filled this survey on behalf of other"
msgstr "Este contacto relleno la encuesta en representación de otro"

#. module: survey_partner_representative
#: model:survey.question,constr_error_msg:survey_partner_representative.survey_representative_q0
#: model:survey.question,constr_error_msg:survey_partner_representative.survey_representative_q1
#: model:survey.question,constr_error_msg:survey_partner_representative.survey_representative_q5
msgid "This question requires an answer."
msgstr "Esta pregunta requiere una respuesta."

#. module: survey_partner_representative
#: model:ir.model,name:survey_partner_representative.model_survey_representative_mixin
msgid "Use this mixin in models that have a linked survey input"
msgstr ""
"Utilice este mixin en modelos que tengan ligada una respuesta de encuesta"

#. module: survey_partner_representative
#: model:survey.question.answer,value:survey_partner_representative.survey_representative_q5_sug3
msgid "Vegan"
msgstr "Vegano"

#. module: survey_partner_representative
#: model:survey.question,title:survey_partner_representative.survey_representative_q5
msgid "What would you like for dinner?"
msgstr "¿Qué le gustaría para cenar?"
Loading

0 comments on commit edc5938

Please sign in to comment.