-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] survey_answer_generation: New module
TT40984
- Loading branch information
1 parent
c40aeba
commit 49adce8
Showing
17 changed files
with
696 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/survey_answer_generation/odoo/addons/survey_answer_generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../survey_answer_generation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
======================== | ||
Survey answer generation | ||
======================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/15.0/survey_answer_generation | ||
:alt: OCA/survey | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_answer_generation | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/200/15.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to prefill answers from one survey to another. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
You can configure either a new or an existing survey. | ||
|
||
#. Go to *Surveys* and choose an existing one or create it. | ||
#. In the *Options* tab, *Questions* group, choose the *Next Survey*. | ||
|
||
Now you'll have to configure the destination questions linked to this survey's questions. | ||
|
||
For regular questions (text, numerical, date): | ||
|
||
#. In the *Answers* tab choose the linked questions. | ||
|
||
Usage | ||
===== | ||
|
||
Once the survey is configured, the users can fill them up as usual. The answers in the | ||
next survey will be prefilled according to the linked 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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/survey/issues/new?body=module:%20survey_answer_generation%0Aversion:%2015.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/15.0/survey_answer_generation>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2022 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Survey answer generation", | ||
"summary": "Pre-generate answers from another survey", | ||
"version": "15.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": [ | ||
"views/survey_question_views.xml", | ||
"views/survey_survey_views.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import survey_question | ||
from . import survey_user_input | ||
from . import survey_survey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2022 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class SurveyQuestion(models.Model): | ||
_inherit = "survey.question" | ||
|
||
next_survey_id = fields.Many2one(related="survey_id.next_survey_id") | ||
next_survey_question_id = fields.Many2one( | ||
comodel_name="survey.question", | ||
domain="[('survey_id', '=', next_survey_id), ('question_type', '=', question_type)]", | ||
help="Prefill this answer of the next survey with the answer of this one", | ||
) | ||
|
||
|
||
class SurveyLabel(models.Model): | ||
_inherit = "survey.question.answer" | ||
|
||
next_survey_question_id = fields.Many2one( | ||
related="question_id.next_survey_question_id" | ||
) | ||
next_survey_question_answer_id = fields.Many2one( | ||
comodel_name="survey.question.answer", | ||
domain="[('question_id', '=', next_survey_question_id)]", | ||
help="Prefill this answer of the next survey with the answer of this one", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2023 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" | ||
|
||
next_survey_id = fields.Many2one(comodel_name="survey.survey") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2022 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class SurveyUserInput(models.Model): | ||
_inherit = "survey.user_input" | ||
|
||
origin_input_id = fields.Many2one(comodel_name="survey.user_input") | ||
|
||
def _mark_done(self): | ||
"""Generate the sale order when the survey is submitted""" | ||
res = super()._mark_done() | ||
if not self.survey_id.next_survey_id: | ||
return res | ||
next_survey_input = self.survey_id.next_survey_id.sudo()._create_answer( | ||
partner=self.partner_id, | ||
email=self.email, | ||
test_entry=self.test_entry, | ||
origin_input_id=self.id, | ||
) | ||
next_answers = self.user_input_line_ids.filtered( | ||
lambda x: x.question_id.next_survey_question_id and not x.skipped | ||
) | ||
# TODO: Implement suggested values | ||
for answer in next_answers.filtered(lambda x: x.answer_type != "suggestion"): | ||
next_survey_input.save_lines( | ||
answer.question_id.next_survey_question_id, | ||
answer[f"value_{answer.answer_type}"], | ||
) | ||
return res | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
You can configure either a new or an existing survey. | ||
|
||
#. Go to *Surveys* and choose an existing one or create it. | ||
#. In the *Options* tab, *Questions* group, choose the *Next Survey*. | ||
|
||
Now you'll have to configure the destination questions linked to this survey's questions. | ||
|
||
For regular questions (text, numerical, date): | ||
|
||
#. In the *Answers* tab choose the linked questions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`_ | ||
|
||
* David Vidal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows to prefill answers from one survey to another. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Once the survey is configured, the users can fill them up as usual. The answers in the | ||
next survey will be prefilled according to the linked questions. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.