diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e69d8f..e1bd370 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,33 +21,30 @@ jobs: name: Setup Log Folder For Reports command: sudo mkdir -p .log && sudo chmod 777 .log - - run: - name: Run Test - command: docker-compose run --rm odoo run_pytest.sh + # - run: + # name: Run Test + # command: docker-compose run --rm odoo run_pytest.sh - - run: - name: Codacy Coverage - command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l python -r .log/coverage.xml - - store_test_results: - path: .log + # - store_test_results: + # path: .log # job that find the next tag for the current branch/repo and push the tag to github. # it will trigger the publish of a new docker image. - auto-tag: - machine: true - steps: - - checkout - - run: - <<: *quay_io_login - - run: - name: Get nws - command: | - curl -L $NWS_BIN_LOCATION > ./nws - chmod +x ./nws - - run: - name: Set tag - command: | - ./nws circleci create-tag -t odoo-base + # auto-tag: + # machine: true + # steps: + # - checkout + # - run: + # <<: *quay_io_login + # - run: + # name: Get nws + # command: | + # curl -L $NWS_BIN_LOCATION > ./nws + # chmod +x ./nws + # - run: + # name: Set tag + # command: | + # ./nws circleci create-tag -t odoo-base workflows: version: 2 @@ -56,10 +53,10 @@ workflows: - tests: context: quay.io - - auto-tag: - context: nws - requires: - - tests - filters: - branches: - only: /^1\d\.0/ + # - auto-tag: + # context: nws + # requires: + # - tests + # filters: + # branches: + # only: /^1\d\.0/ diff --git a/.docker_files/main/__init__.py b/.docker_files/main/__init__.py index d74e01b..aa680fd 100644 --- a/.docker_files/main/__init__.py +++ b/.docker_files/main/__init__.py @@ -1,2 +1,2 @@ -# © 2022 Numigi +# © 2024 Numigi # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). diff --git a/.docker_files/main/__manifest__.py b/.docker_files/main/__manifest__.py index ca42c2b..37fb406 100644 --- a/.docker_files/main/__manifest__.py +++ b/.docker_files/main/__manifest__.py @@ -1,4 +1,4 @@ -# © 2022 Numigi +# © 2024 Numigi # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { @@ -11,9 +11,7 @@ 'category': 'Other', 'summary': 'Install all addons required for testing.', 'depends': [ - 'survey_answer_for_partner', # TA#7643 - # 'survey_condition', - 'survey_type', # TA#4707 + 'survey', ], 'installable': True, } diff --git a/.docker_files/main/tests/__init__.py b/.docker_files/main/tests/__init__.py deleted file mode 100644 index 6da6a15..0000000 --- a/.docker_files/main/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import test_installed_modules diff --git a/.docker_files/main/tests/test_installed_modules.py b/.docker_files/main/tests/test_installed_modules.py deleted file mode 100644 index 21aec03..0000000 --- a/.docker_files/main/tests/test_installed_modules.py +++ /dev/null @@ -1,17 +0,0 @@ - -from odoo.tests import TransactionCase - - -class TestModules(TransactionCase): - """Test that Odoo modules are installed. - - Because some web modules have no python tests, - we test that these modules are installed. - """ - - def setUp(self): - super(TestModules, self).setUp() - self.modules = self.env['ir.module.module'] - - def test_survey_type_module_is_installed(self): - self.assertTrue(self.modules.search([('name', '=', 'survey_type')])) diff --git a/.docker_files/odoo.conf b/.docker_files/odoo.conf index 523df7d..46ecc9a 100644 --- a/.docker_files/odoo.conf +++ b/.docker_files/odoo.conf @@ -49,7 +49,7 @@ test_report_directory = False translate_modules = ['all'] unaccent = False without_demo = False -workers = 2 +workers = 0 xmlrpc = True xmlrpc_interface = xmlrpc_port = 8069 diff --git a/.docker_files/test-requirements.txt b/.docker_files/test-requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..b6a254e --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +[flake8] +max-line-length = 88 +max-complexity = 16 +# B = bugbear +# B9 = bugbear opinionated (incl line length) +select = C,E,F,W,B,B9 +# E203: whitespace before ':' (black behaviour) +# E501: flake8 line length (covered by bugbear B950) +# W503: line break before binary operator (black behaviour) +ignore = E203,E501,W503,F821 +per-file-ignores= + __init__.py:F401 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..94dc196 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,36 @@ +name: pre-commit + +on: + pull_request: + branches: + - "16.0" + push: + branches: + - "16.0" + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: "3.11" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v1 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure --color=always + - name: Check that all files generated by pre-commit are in git + run: | + newfiles="$(git ls-files --others --exclude-from=.gitignore)" + if [ "$newfiles" != "" ] ; then + echo "Please check-in the following files:" + echo "$newfiles" + exit 1 + fi diff --git a/.gitignore b/.gitignore index b9b04fe..7ff1b8c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,5 @@ __pycache__/ Pipfile docker-compose.override.yml .DS_STORE -.third-party-addons .pytest_cache .vscode diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..28b1b49 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +exclude: | + (?x) + # NOT INSTALLABLE ADDONS + # END NOT INSTALLABLE ADDONS + # Files and folders generated by bots, to avoid loops + ^setup/|/static/description/index\.html$| + # We don't want to mess with tool-generated files + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| + # Maybe reactivate this when all README files include prettier ignore tags? + ^README\.md$| + # Library files can have extraneous formatting (even minimized) + /static/(src/)?lib/| + # Repos using Sphinx to generate docs don't need prettying + ^docs/_templates/.*\.html$| + # Don't bother non-technical authors with formatting issues in docs + readme/.*\.(rst|md)$| + # Ignore build and dist directories in addons + /build/|/dist/| + # You don't usually want a bot to modify your legal texts + (LICENSE.*|COPYING.*) +default_language_version: + python: python3 + node: "14.13.0" +repos: + - repo: https://github.com/PyCQA/flake8 + rev: 3.8.3 + hooks: + - id: flake8 + name: flake8 + additional_dependencies: ["flake8-bugbear==20.1.4"] diff --git a/.unported/survey_condition/README.rst b/.unported/survey_condition/README.rst deleted file mode 100644 index 7a67186..0000000 --- a/.unported/survey_condition/README.rst +++ /dev/null @@ -1,67 +0,0 @@ -Survey Condition -================ - -This module allows to skip survey pages based on answers. - -.. contents:: Table of Contents - -Configuration -------------- -In the form view of a question, the table of answers contains two new columns: - -* ``Skip Option`` -* ``Page`` - -.. image:: static/description/question_form.png - -The field ``Skip Option`` has three possible values: - -* ``Skip Next Page`` -* ``Go To Specific Page`` -* ``Send Form`` - -When a user answers this question, the skip option for the selected item is applied. - -Skip Next Page -~~~~~~~~~~~~~~ -When ``Skip Next Page`` is selected, the next page in the survey is skipped, -whatever that page might be. - -Go To Specific Page -~~~~~~~~~~~~~~~~~~~ -When ``Go To Specific Page`` is selected, the field ``Page`` becomes editable and required. - -.. image:: static/description/question_form_specific_page.png - -When the answer is submitted by a user, all pages between the current page and the target page are skipped. - -Send Form -~~~~~~~~~ -When ``Send Form`` is selected, after submitting the survey page, all remaining pages are skipped. -The user is redirected to the final page in order to submit the form. - -Usage ------ -Suppose the first question of the survey is configured as follow. - -.. image:: static/description/question_form_configured.png - -As a partner, I begin to fill the survey. - -.. image:: static/description/survey_1.png - -I select the answer with a skip condition. Then I click on ``Next Page``. - -.. image:: static/description/survey_2.png - -I notice that the pages 2 and 3 were skipped. - -.. image:: static/description/survey_3.png - -Contributors ------------- -* Numigi (tm) and all its contributors (https://bit.ly/numigiens) - -More information ----------------- -* Meet us at https://bit.ly/numigi-com diff --git a/.unported/survey_condition/__init__.py b/.unported/survey_condition/__init__.py deleted file mode 100644 index 025fa42..0000000 --- a/.unported/survey_condition/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import models, controllers diff --git a/.unported/survey_condition/__manifest__.py b/.unported/survey_condition/__manifest__.py deleted file mode 100644 index 6531366..0000000 --- a/.unported/survey_condition/__manifest__.py +++ /dev/null @@ -1,22 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -{ - 'name': 'Survey Skip Condition', - 'version': "14.0.1.0.0", - 'author': 'Numigi', - 'maintainer': 'Numigi', - 'website': 'https://bit.ly/numigi-com', - 'license': 'LGPL-3', - 'category': 'Survey', - 'summary': 'Add skip conditions to surveys.', - 'depends': ['survey'], - 'data': [ - 'security/ir.model.access.csv', - 'views/survey_question.xml', - 'views/survey_label.xml', - 'views/templates.xml', - 'data/survey.xml', - ], - 'installable': True, -} diff --git a/.unported/survey_condition/controllers/__init__.py b/.unported/survey_condition/controllers/__init__.py deleted file mode 100644 index 832bb36..0000000 --- a/.unported/survey_condition/controllers/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import survey diff --git a/.unported/survey_condition/controllers/survey.py b/.unported/survey_condition/controllers/survey.py deleted file mode 100644 index d20b01a..0000000 --- a/.unported/survey_condition/controllers/survey.py +++ /dev/null @@ -1,182 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -import json -import logging - -from odoo import http, SUPERUSER_ID -from odoo.addons.survey.controllers.main import Survey -from odoo.http import request - -_logger = logging.getLogger(__name__) - - -fill_survey_decorator = http.route( - ['/survey/fill//', - '/survey/fill///'], - type='http', auth='public', website=True) - - -class SurveyWithSkipConditions(Survey): - - @http.route(['/survey/submit/'], - type='http', methods=['POST'], auth='public', website=True) - def submit(self, survey, **post): - """Set the state of the survey to completed_but_not_sent if required. - - When the survey is completed but the last page seen is not the last page - of the survey, the state is set to completed_but_not_sent. - - The method was completely overiddre because it could not be properly inherited. - - The original method can be found at - https://github.com/odoo/odoo/blob/11.0/addons/survey/controllers/main.py#L207 - """ - env = request.env - - _logger.debug('Incoming data: %s', post) - page_id = int(post['page_id']) - questions = env['survey.question'].search([('page_id', '=', page_id)]) - - errors = {} - for question in questions: - answer_tag = "%s_%s_%s" % (survey.id, page_id, question.id) - errors.update(question.validate_question(post, answer_tag)) - - ret = {} - if len(errors): - ret['errors'] = errors - else: - try: - user_input = env['survey.user_input'].sudo().search( - [('token', '=', post['token'])], limit=1) - except KeyError: - return request.render("website.403") - - user_id = env.user.id if user_input.type != 'link' else SUPERUSER_ID - - for question in questions: - answer_tag = "%s_%s_%s" % (survey.id, page_id, question.id) - env['survey.user_input_line'].with_user(user=user_id).save_lines( - user_input.id, question, post, answer_tag) - - go_back = post['button_submit'] == 'previous' - - next_page, _, last = env['survey.survey'].next_page( - user_input, page_id, go_back=go_back) - - vals = {'last_displayed_page_id': page_id} - - ############################################## - # Only the following block was modified - ############################################## - last_displayed_page = env['survey.page'].browse(page_id) - - if not go_back: - user_input.add_page_to_history(last_displayed_page) - - last_displayed_is_last_page = ( - last_displayed_page == last_displayed_page.survey_id.page_ids[-1] - ) - survey_is_completed = next_page is None and not go_back - - if last_displayed_is_last_page and survey_is_completed: - vals.update({'state': 'done'}) - elif not last_displayed_is_last_page and survey_is_completed: - vals.update({'state': 'completed_but_not_sent'}) - else: - vals.update({'state': 'skip'}) - - ############################################## - # Modified block ends here - ############################################## - - user_input.with_user(user=user_id).write(vals) - ret['redirect'] = '/survey/fill/%s/%s' % (survey.id, post['token']) - - if go_back: - ret['redirect'] += '/prev' - - return json.dumps(ret) - - @fill_survey_decorator - def fill_survey(self, survey, token, prev=None, **post): - """If the survey is completed but not done, render the confirmation page.""" - user_input = self._get_user_input_from_token(token) - if not user_input: - return request.render("website.403") - - if user_input.state == 'completed_but_not_sent': - return request.render( - 'survey_condition.send_confirmation_page', - {'survey': survey, 'token': token, 'user_input': user_input}) - - return super().fill_survey(survey=survey, token=token, prev=prev, **post) - - @http.route(['/survey/completed/'], - type='http', methods=['POST'], auth='public', website=True) - def submit_from_completed_page(self, token, **post): - user_input = self._get_user_input_from_token(token) - if not user_input: - return request.render("website.403") - - go_back = post['button_submit'] == 'previous' - - if go_back: - return json.dumps({ - 'redirect': '/survey/go_back_from_completed_page/{token}'.format( - token=user_input.token) - }) - else: - user_input.state = 'done' - return json.dumps({ - 'redirect': '/survey/fill/{survey_id}/{token}'.format( - survey_id=user_input.survey_id.id, token=user_input.token) - }) - - @http.route(['/survey/go_back_from_completed_page/'], - type='http', auth='public', website=True) - def go_back_from_completed_page(self, token, **post): - user_input = self._get_user_input_from_token(token) - if not user_input: - return request.render("website.403") - - user_input.state = 'skip' - - page = user_input.last_displayed_page_id - page_number = list(page.survey_id.page_ids).index(page) - - data = { - 'survey': page.survey_id, - 'page': page, - 'page_nr': page_number, - 'token': user_input.token, - } - - is_last_page = page == page.survey_id.page_ids[-1] - if is_last_page: - data.update({'last': True}) - - return request.render('survey.survey', data) - - @staticmethod - def _get_user_input_from_token(token): - return request.env['survey.user_input'].sudo().search([('token', '=', token)], limit=1) - - -class SurveyWithPopPageHistoryLine(Survey): - """When the user clicks on the previous button, remove one entry from the history. - - Each time the user clicks on previous, he is forwarded one step back recursively. - """ - - @fill_survey_decorator - def fill_survey(self, survey, token, prev=None, **post): - result = super().fill_survey(survey=survey, token=token, prev=prev, **post) - - if prev: - user_input = self._get_user_input_from_token(token) - if user_input: - user_input.pop_previous_page() - - return result diff --git a/.unported/survey_condition/data/survey.xml b/.unported/survey_condition/data/survey.xml deleted file mode 100644 index 3fb8438..0000000 --- a/.unported/survey_condition/data/survey.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - 1 - I live in Canada - - - - \ No newline at end of file diff --git a/.unported/survey_condition/i18n/fr.po b/.unported/survey_condition/i18n/fr.po deleted file mode 100644 index 8f5fb76..0000000 --- a/.unported/survey_condition/i18n/fr.po +++ /dev/null @@ -1,181 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * survey_condition -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0+e\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-21 13:42+0000\n" -"PO-Revision-Date: 2019-01-21 08:43-0500\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"Language: fr\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"X-Generator: Poedit 2.0.6\n" - -#. module: survey_condition -#: selection:survey.user_input,state:0 -msgid "Completed" -msgstr "Complété" - -#. module: survey_condition -#: selection:survey.user_input,state:0 -msgid "Completed But Not Sent" -msgstr "" - -#. module: survey_condition -#: code:addons/survey_condition/models/survey.py:56 -#, python-format -msgid "" -"Could not evaluate the next page for the survey {survey}. Invalid skip " -"option {option}." -msgstr "" -"La page suivante n'a pas pu être évaluée pour le sondage {survey}. L'option " -"de saut de page {option} est invalide." - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__create_uid -msgid "Created by" -msgstr "" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__create_date -msgid "Created on" -msgstr "" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__display_name -msgid "Display Name" -msgstr "" - -#. module: survey_condition -#: selection:survey.label,skip_option:0 -msgid "Go To Specific Page" -msgstr "Sauter à une page définie" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__id -msgid "ID" -msgstr "" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__input_id -msgid "Input" -msgstr "" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history____last_update -msgid "Last Modified on" -msgstr "" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__write_uid -msgid "Last Updated by" -msgstr "" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__write_date -msgid "Last Updated on" -msgstr "" - -#. module: survey_condition -#: selection:survey.user_input,state:0 -msgid "Not started yet" -msgstr "" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_label__skip_option_page_id -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input_page_history__page_id -msgid "Page" -msgstr "Page" - -#. module: survey_condition -#: selection:survey.user_input,state:0 -msgid "Partially completed" -msgstr "Complété partiellement" - -#. module: survey_condition -#: model_terms:ir.ui.view,arch_db:survey_condition.send_confirmation_page -msgid "Please confirm that you wish to send the survey." -msgstr "Confirmez que vous souhaitez transmettre le sondage." - -#. module: survey_condition -#: model_terms:ir.ui.view,arch_db:survey_condition.send_confirmation_page -msgid "Previous Page" -msgstr "Page précédente" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_label__question_survey_id -msgid "Question Survey" -msgstr "Sondage de la question" - -#. module: survey_condition -#: selection:survey.label,skip_option:0 -msgid "Send Form" -msgstr "Envoyer le formulaire" - -#. module: survey_condition -#: selection:survey.label,skip_option:0 -msgid "Skip Next Page" -msgstr "Sauter la page suivante" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_label__skip_option -msgid "Skip Option" -msgstr "Option de saut" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_label__skip_option_survey_id -msgid "Skip Option Survey" -msgstr "Sondage de l'option de saut" - -#. module: survey_condition -#: model:ir.model.fields,field_description:survey_condition.field_survey_user_input__state -msgid "Status" -msgstr "" - -#. module: survey_condition -#: model_terms:ir.ui.view,arch_db:survey_condition.send_confirmation_page -msgid "Submit Survey" -msgstr "Transmettre le sondage" - -#. module: survey_condition -#: model:ir.model,name:survey_condition.model_survey_survey -msgid "Survey" -msgstr "Sondage" - -#. module: survey_condition -#: model_terms:ir.ui.view,arch_db:survey_condition.send_confirmation_page -msgid "Survey Completed" -msgstr "Sondage complété" - -#. module: survey_condition -#: model:ir.model,name:survey_condition.model_survey_label -msgid "Survey Label" -msgstr "" - -#. module: survey_condition -#: model:ir.model,name:survey_condition.model_survey_user_input -msgid "Survey User Input" -msgstr "" - -#. module: survey_condition -#: code:addons/survey_condition/models/survey_label.py:46 -#, python-format -msgid "" -"The question choice {choice} has a skip option to the {page} of the survey " -"{skip_option_survey}. This survey is different from the survey of the " -"question {question} ({question_survey})." -msgstr "" -"Le choix de question {choice} a une option de saut à la page {page} du " -"sondage {skip_option_survey}. Ce sondage n'est pas le même que celui de la " -"question {question} ({question_survey})." - -#. module: survey_condition -#: model:ir.model,name:survey_condition.model_survey_user_input_page_history -msgid "survey.user_input.page.history" -msgstr "" diff --git a/.unported/survey_condition/models/__init__.py b/.unported/survey_condition/models/__init__.py deleted file mode 100644 index 227a44c..0000000 --- a/.unported/survey_condition/models/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import ( - survey, - survey_label, - survey_user_input, -) diff --git a/.unported/survey_condition/models/survey.py b/.unported/survey_condition/models/survey.py deleted file mode 100644 index 22f1659..0000000 --- a/.unported/survey_condition/models/survey.py +++ /dev/null @@ -1,105 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import api, models, _ -from odoo.exceptions import ValidationError - - -class SurveyWithSkipConditions(models.Model): - - _inherit = 'survey.survey' - - @api.model - def next_page(self, user_input, page_id, go_back=False): - """Check for any anwser with a skip option when searching for the next page. - - The question inputs are checked in the reversed order so that the last - questions are prioritized. - - If any input with a skip option is found, the rule for that option is applied - instead of the standard algorithm. - """ - current_page = self.env['survey.page'].browse(page_id) - - reversed_page_input_lines = ( - user_input.user_input_line_ids - .filtered(lambda l: l.page_id == current_page) - .sorted(key=lambda l: -l.question_id.sequence) - ) - - value_with_skip_option = next(( - l.value_suggested for l in reversed_page_input_lines - if l.question_id.type == 'simple_choice' and l.value_suggested.skip_option - ), None) - - if value_with_skip_option is not None: - return self._get_next_page_from_skip_option( - current_page, - option=value_with_skip_option.skip_option, - specific_page=value_with_skip_option.skip_option_page_id) - - else: - return super().next_page(user_input=user_input, page_id=page_id, go_back=go_back) - - def _get_next_page_from_skip_option(self, current_page, option, specific_page): - if option == 'send_form': - # Send the form - return (None, -1, False) - - elif option == 'skip_page': - return self._get_next_page_from_skip_option_skip_page(current_page) - - elif option == 'specific_page': - return self._get_next_page_from_skip_option_specific_page(current_page, specific_page) - - else: - raise ValidationError(_( - 'Could not evaluate the next page for the survey {survey}. ' - 'Invalid skip option {option}.' - ).format(survey=current_page.survey_id.display_name, option=option)) - - @staticmethod - def _get_next_page_from_skip_option_skip_page(current_page): - pages = list(current_page.survey_id.page_ids) - - # If the current page is last or the next page is last, then send the form - if current_page in pages[-2:]: - return (None, -1, False) - - else: - current_page_index = pages.index(current_page) - next_page_index = current_page_index + 2 - is_last_page = next_page_index == len(pages) - 1 - return (pages[next_page_index], next_page_index, is_last_page) - - @staticmethod - def _get_next_page_from_skip_option_specific_page(current_page, specific_page): - pages = list(current_page.survey_id.page_ids) - specific_page_index = pages.index(specific_page) - specific_page_is_last = specific_page_index == len(pages) - 1 - return (specific_page, specific_page_index, specific_page_is_last) - - -class SurveyWithGoBackAfterSkipingPage(models.Model): - - _inherit = 'survey.survey' - - @api.model - def next_page(self, user_input, page_id, go_back=False): - """When the user clicked on `Go Back`, the last page from the history is returned.""" - if go_back: - return self._get_previous_page(user_input) - else: - return super().next_page(user_input=user_input, page_id=page_id, go_back=False) - - @staticmethod - def _get_previous_page(user_input): - """Get a tuple reprensenting the last page seen by the user.""" - previous_page = user_input.get_previous_page() - - if not previous_page: - previous_page = user_input.survey_id.page_ids[0] - - pages = list(user_input.survey_id.page_ids) - page_index = pages.index(previous_page) - return (previous_page, page_index, False) diff --git a/.unported/survey_condition/models/survey_label.py b/.unported/survey_condition/models/survey_label.py deleted file mode 100644 index ccbd28b..0000000 --- a/.unported/survey_condition/models/survey_label.py +++ /dev/null @@ -1,76 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import api, fields, models, _ -from odoo.exceptions import ValidationError - - -class SurveyLabelWithConstraintOnSkipOptionPage(models.Model): - """Prevent a survey option from skiping to a page that belongs to a different suvrvey.""" - - _name = 'survey.label' - _rec_name = 'value' - _order = 'sequence,id' - _description = 'Survey Label' - - question_id = fields.Many2one('survey.question', string='Question', ondelete='cascade') - question_id_2 = fields.Many2one('survey.question', string='Question 2', ondelete='cascade') - sequence = fields.Integer('Label Sequence order', default=10) - value = fields.Char('Suggested value', translate=True, required=True) - quizz_mark = fields.Float('Score for this choice', - help="A positive score indicates a correct choice; a negative or null score indicates a wrong answer") - - - skip_option = fields.Selection([ - ('skip_page', 'Skip Next Page'), - ('specific_page', 'Go To Specific Page'), - ('send_form', 'Send Form'), - ], 'Skip Option') - - skip_option_page_id = fields.Many2one('survey.question', 'Page', domain=[('is_page', '=', True)], - ondelete='restrict') - - @api.constrains('question_id', 'question_id_2') - def _check_question_not_empty(self): - """Ensure that field question_id XOR field question_id_2 is not null""" - if not bool(self.question_id) != bool(self.question_id_2): - raise ValidationError(_("A label must be attached to only one question.")) - - skip_option_survey_id = fields.Many2one( - 'survey.survey', 'Skip Option Survey', - related='skip_option_page_id.survey_id', store=True, readonly=True) - - question_survey_id = fields.Many2one( - 'survey.survey', 'Question Survey', - related='question_id.page_id.survey_id', store=True, readonly=True) - - @api.constrains('skip_option_survey_id', 'question_survey_id', 'skip_option') - def _check_specific_option_belons_to_same_survey(self): - labels_with_skip_to_specific_page = self.filtered( - lambda l: l.skip_option == 'specific_page') - - for label in labels_with_skip_to_specific_page: - if label.skip_option_survey_id != label.question_survey_id: - raise ValidationError(_( - 'The question choice {choice} has a skip option ' - 'of the survey {skip_option_survey}. ' - 'This survey is different from the survey of ' - 'the question {question} ({question_survey}).' - ).format( - choice=label.display_name, - question=label.question_id.display_name, - skip_option_survey=label.skip_option_survey_id.display_name, - question_survey=label.question_survey_id.display_name, - )) - - @api.onchange('skip_option') - def _onchange_skip_option_if_not_specific_page_empty_skip_option_page_id(self): - if self.skip_option != 'specific_page': - self.skip_option_page_id = None - - -class SurveyQuestion(models.Model): - - _inherit = 'survey.question' - - labels_ids = fields.One2many('survey.label', 'question_id', string='Types of answers', copy=True) diff --git a/.unported/survey_condition/models/survey_user_input.py b/.unported/survey_condition/models/survey_user_input.py deleted file mode 100644 index 6a37997..0000000 --- a/.unported/survey_condition/models/survey_user_input.py +++ /dev/null @@ -1,57 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import fields, models - - -class SurveyUserInputWithStateCompletedNotSent(models.Model): - - _inherit = 'survey.user_input' - - state = fields.Selection(selection_add=[('completed_but_not_sent', 'Completed But Not Sent')]) - - -class SurveyInputWithPreviousPage(models.Model): - - _inherit = 'survey.user_input' - - def pop_previous_page(self): - """Pop the last page seen from the page history of the user input. - - :return: the last seen page (survey.page) - """ - history_line = self._get_previous_history_line() - page = history_line.mapped('page_id') - history_line.unlink() - return page - - def get_previous_page(self): - """Get the last page seen from the page history of the user input. - - :return: the last seen page (survey.page) - """ - history_line = self._get_previous_history_line() - return history_line.mapped('page_id') - - def _get_previous_history_line(self): - return self.env['survey.user_input.page.history'].search( - [('input_id', '=', self.id)], order='id desc', limit=1) - - def add_page_to_history(self, page): - """Add a page to the user input's history. - - :param page: the survey page to add (survey.page) - """ - self.env['survey.user_input.page.history'].create({ - 'input_id': self.id, - 'page_id': page.id, - }) - - -class SurveyUserInputPageHistory(models.Model): - - _name = 'survey.user_input.page.history' - - input_id = fields.Many2one( - 'survey.user_input', 'Input', required=True, index=True, ondelete='cascade') - page_id = fields.Many2one('survey.page', 'Page') diff --git a/.unported/survey_condition/security/ir.model.access.csv b/.unported/survey_condition/security/ir.model.access.csv deleted file mode 100644 index 6bb4eda..0000000 --- a/.unported/survey_condition/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_survey_user_input_page_history,access_survey_user_input_page_history,model_survey_user_input_page_history,,1,0,0,0 diff --git a/.unported/survey_condition/static/description/question_form.png b/.unported/survey_condition/static/description/question_form.png deleted file mode 100644 index c175a2b..0000000 Binary files a/.unported/survey_condition/static/description/question_form.png and /dev/null differ diff --git a/.unported/survey_condition/static/description/question_form_configured.png b/.unported/survey_condition/static/description/question_form_configured.png deleted file mode 100644 index 4119dcc..0000000 Binary files a/.unported/survey_condition/static/description/question_form_configured.png and /dev/null differ diff --git a/.unported/survey_condition/static/description/question_form_specific_page.png b/.unported/survey_condition/static/description/question_form_specific_page.png deleted file mode 100644 index db7ddd8..0000000 Binary files a/.unported/survey_condition/static/description/question_form_specific_page.png and /dev/null differ diff --git a/.unported/survey_condition/static/description/survey_1.png b/.unported/survey_condition/static/description/survey_1.png deleted file mode 100644 index f686415..0000000 Binary files a/.unported/survey_condition/static/description/survey_1.png and /dev/null differ diff --git a/.unported/survey_condition/static/description/survey_2.png b/.unported/survey_condition/static/description/survey_2.png deleted file mode 100644 index ea2c22a..0000000 Binary files a/.unported/survey_condition/static/description/survey_2.png and /dev/null differ diff --git a/.unported/survey_condition/static/description/survey_3.png b/.unported/survey_condition/static/description/survey_3.png deleted file mode 100644 index bcf16e5..0000000 Binary files a/.unported/survey_condition/static/description/survey_3.png and /dev/null differ diff --git a/.unported/survey_condition/tests/__init__.py b/.unported/survey_condition/tests/__init__.py deleted file mode 100644 index 29cd4fa..0000000 --- a/.unported/survey_condition/tests/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). diff --git a/.unported/survey_condition/tests/abdel_test_survey_skip_option.py b/.unported/survey_condition/tests/abdel_test_survey_skip_option.py deleted file mode 100644 index 4519cf5..0000000 --- a/.unported/survey_condition/tests/abdel_test_survey_skip_option.py +++ /dev/null @@ -1,181 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo.tests import common - - -class TestSurveySkipOption(common.SavepointCase): - - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.survey = cls.env.ref('survey.survey_feedback') - cls.user = cls.env.ref('base.demo_user0') - cls.user_input = cls.env['survey.user_input'].create({ - 'survey_id': cls.survey.id, - }) - - cls.page_1 = cls.env.ref('survey.survey_feedback_p1') - cls.page_2 = cls.env.ref('survey.survey_feedback_p2') - cls.page_3 = cls.env.ref('survey.survey_feedback_p1') - cls.page_4 = cls.env.ref('survey.survey_feedback_p2') - - # Make questions 1.2, 3.1 and 4.1 simple_choice instead of multiple_choice - questions = ( - cls.env.ref('survey.survey_feedback_p1_q1') | cls.env.ref('survey.survey_feedback_p1_q2') | - cls.env.ref('survey.survey_feedback_p2_q1') - ) - questions.write({'question_type': 'simple_choice'}) - - # Page 1 - cls.input_line_1_1 = cls.env['survey.user_input_line'].create({ - 'user_input_id': cls.user_input.id, - 'question_id': cls.env.ref('survey.feedback_1_1').id, - 'value_suggested': cls.env.ref('survey.choice_1_1_1').id, - 'answer_type': 'suggestion', - }) - cls.input_line_1_2 = cls.env['survey.user_input_line'].create({ - 'user_input_id': cls.user_input.id, - 'question_id': cls.env.ref('survey.feedback_1_2').id, - 'value_suggested': cls.env.ref('survey.choice_1_2_1').id, - 'answer_type': 'suggestion', - }) - - # Page 2 - cls.input_line_2_6 = cls.env['survey.user_input_line'].create({ - 'user_input_id': cls.user_input.id, - 'question_id': cls.env.ref('survey.feedback_2_6').id, - 'value_suggested': cls.env.ref('survey.choice_2_6_1').id, - 'answer_type': 'suggestion', - }) - - # Page 3 - cls.input_line_3_1 = cls.env['survey.user_input_line'].create({ - 'user_input_id': cls.user_input.id, - 'question_id': cls.env.ref('survey.feedback_3_1').id, - 'value_suggested': cls.env.ref('survey.choice_3_1_1').id, - 'answer_type': 'suggestion', - }) - - cls.input_line_3_2 = cls.env['survey.user_input_line'].create({ - 'user_input_id': cls.user_input.id, - 'question_id': cls.env.ref('survey.feedback_3_1').id, - 'value_free_text': 'Text value for page 3, question 2', - 'answer_type': 'free_text', - }) - - cls.input_line_3_3 = cls.env['survey.user_input_line'].create({ - 'user_input_id': cls.user_input.id, - 'question_id': cls.env.ref('survey.feedback_3_1').id, - 'value_free_text': 'Text value for page 3, question 3', - 'answer_type': 'free_text', - }) - - def _get_next_page(self, current_page, go_back=False): - return self.env['survey.survey'].next_page( - self.user_input, current_page.id, go_back=go_back) - - def test_ifNoSkipOption_thenNextPageSelected(self): - values = self._get_next_page(self.page_1) - self.assertEqual(values, (self.page_2, 1, False)) - - values = self._get_next_page(self.page_2) - self.assertEqual(values, (self.page_3, 2, False)) - - values = self._get_next_page(self.page_3) - self.assertEqual(values, (self.page_4, 3, True)) - - values = self._get_next_page(self.page_4) - self.assertEqual(values, (None, -1, False)) - - def test_ifSkipNextFromPage1_thenNextPageIsPage3(self): - choice = self.env.ref('survey.choice_1_1_1') - choice.skip_option = 'skip_page' - - values = self._get_next_page(self.page_1) - self.assertEqual(values, (self.page_3, 2, False)) - - def test_ifSkipNextFromPage2_thenNextPageIsPage4(self): - choice = self.env.ref('survey.choice_2_6_1') - choice.skip_option = 'skip_page' - - values = self._get_next_page(self.page_2) - self.assertEqual(values, (self.page_4, 3, True)) - - def test_ifSkipNextFromPage3_thenNextPageIsNone(self): - choice = self.env.ref('survey.choice_3_1_1') - choice.skip_option = 'skip_page' - - values = self._get_next_page(self.page_3) - self.assertEqual(values, (None, -1, False)) - - def test_ifSkipNextFromPage4_thenNextPageIsNone(self): - choice = self.env.ref('survey.choice_4_1_1') - choice.skip_option = 'skip_page' - - values = self._get_next_page(self.page_4) - self.assertEqual(values, (None, -1, False)) - - def test_ifSkipFromPage1To3_thenLastPageIsFalse(self): - choice = self.env.ref('survey.choice_1_1_1') - choice.write({ - 'skip_option': 'specific_page', - 'skip_option_page_id': self.page_3.id, - }) - - values = self._get_next_page(self.page_1) - self.assertEqual(values, (self.page_3, 2, False)) - - def test_ifSkipFromPage1To4_thenLastPageIsTrue(self): - choice = self.env.ref('survey.choice_1_1_1') - choice.write({ - 'skip_option': 'specific_page', - 'skip_option_page_id': self.page_4.id, - }) - - values = self._get_next_page(self.page_1) - self.assertEqual(values, (self.page_4, 3, True)) - - def test_ifSendFormFromPage1_thenNextPageisNone(self): - choice = self.env.ref('survey.choice_1_1_1') - choice.skip_option = 'send_form' - - values = self._get_next_page(self.page_1) - self.assertEqual(values, (None, -1, False)) - - def test_ifMultipleSkipOptions_thenLastOptionIsSelected(self): - choice = self.env.ref('survey.choice_1_1_1') - choice.skip_option = 'send_form' - - choice = self.env.ref('survey.choice_1_2_1') - choice.skip_option = 'skip_page' - - values = self._get_next_page(self.page_1) - self.assertEqual(values, (self.page_3, 2, False)) - - def test_skipOptionsOnPage2_hasNoImpactOnPage1(self): - choice = self.env.ref('survey.choice_1_1_1') - choice.skip_option = 'send_form' - - choice = self.env.ref('survey.choice_2_6_1') - choice.skip_option = 'skip_page' - - values = self._get_next_page(self.page_1) - self.assertEqual(values, (None, -1, False)) - - def test_go_back_after_page_skip(self): - self.user_input.add_page_to_history(self.page_1) - values = self._get_next_page(self.page_3, go_back=True) - self.assertEqual(values, (self.page_1, 0, False)) - - def test_go_back_twice_after_page_skip(self): - self.user_input.add_page_to_history(self.page_1) - self.user_input.add_page_to_history(self.page_3) - - values = self._get_next_page(self.page_4, go_back=True) - self.assertEqual(values, (self.page_3, 2, False)) - - self.user_input.pop_previous_page() - - values = self._get_next_page(self.page_3, go_back=True) - self.assertEqual(values, (self.page_1, 0, False)) diff --git a/.unported/survey_condition/tests/test_survey_label_constraint.py b/.unported/survey_condition/tests/test_survey_label_constraint.py deleted file mode 100644 index aa98b50..0000000 --- a/.unported/survey_condition/tests/test_survey_label_constraint.py +++ /dev/null @@ -1,35 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo.tests import common -from odoo.exceptions import ValidationError - - -class TestSurveyLabelConstraint(common.SavepointCase): - - @classmethod - def setUpClass(cls): - super().setUpClass() - - # Make the option #1 of question #1 point to the page #2 - cls.env.ref('survey_condition.choice_1_1_1').sudo().write({ - 'skip_option': 'specific_page', - 'skip_option_page_id': cls.env.ref('survey.survey_feedback_p1').id, - }) - - def test_ifPageIsBoundToSkipOption_thenCannotMoveThePageToOtherSurvey(self): - new_survey = self.env['survey.survey'].sudo().create({'title': 'New Survey'}) - - page_2 = self.env.ref('survey.survey_feedback_p1_q1') - - with self.assertRaises(ValidationError): - page_2.survey_id = new_survey - - def test_ifPageIsBoundToSkipOption_thenCannotMoveTheQuestionToOtherSurvey(self): - new_survey = self.env['survey.survey'].create({'title': 'New Survey'}) - - # The page (#1) that contains the option that points to page #2 - page_1 = self.env.ref('survey.survey_feedback_p1_q1') - print(page_1.survey_id.id,new_survey.id) - with self.assertRaises(ValidationError): - page_1.survey_id = new_survey diff --git a/.unported/survey_condition/views/survey_label.xml b/.unported/survey_condition/views/survey_label.xml deleted file mode 100644 index 49a20ba..0000000 --- a/.unported/survey_condition/views/survey_label.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - survey_label_tree - survey.label - - - - - - - - - - - - survey_label_search - survey.label - - - - - - - - - - Labels - survey.label - tree,form - - {'search_default_group_by_question': True} - -

- No survey labels found -

-
-
- -
\ No newline at end of file diff --git a/.unported/survey_condition/views/survey_question.xml b/.unported/survey_condition/views/survey_question.xml deleted file mode 100644 index dbea07f..0000000 --- a/.unported/survey_condition/views/survey_question.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Survey Question View With Skip Option - survey.question - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.unported/survey_condition/views/templates.xml b/.unported/survey_condition/views/templates.xml deleted file mode 100644 index 1004667..0000000 --- a/.unported/survey_condition/views/templates.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - diff --git a/Dockerfile b/Dockerfile index d666ae5..055c5de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,15 @@ -FROM quay.io/numigi/odoo-public:14.8 -MAINTAINER numigi +FROM quay.io/numigi/odoo-public:16.latest +LABEL maintainer="contact@numigi.com" -USER odoo +USER root + +COPY .docker_files/test-requirements.txt . +RUN pip3 install -r test-requirements.txt -COPY survey_answer_for_partner /mnt/extra-addons/survey_answer_for_partner -#COPY survey_condition /mnt/extra-addons/survey_condition -COPY survey_type /mnt/extra-addons/survey_type +ENV THIRD_PARTY_ADDONS /mnt/third-party-addons +RUN mkdir -p "${THIRD_PARTY_ADDONS}" && chown -R odoo "${THIRD_PARTY_ADDONS}" + +USER odoo COPY .docker_files/main /mnt/extra-addons/main COPY .docker_files/odoo.conf /etc/odoo diff --git a/docker-compose.yml b/docker-compose.yml index 2d4b0fb..a61165e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,9 +5,8 @@ services: context: . dockerfile: Dockerfile volumes: - - odoo-web-data:/var/lib/odoo + - odoo16-web-data:/var/lib/odoo - ./.log:/var/log/odoo - - ./survey_type:/mnt/extra-addons/survey_type ports: - "8069:8069" - "8071:8071" @@ -17,16 +16,16 @@ services: environment: - LOG_ODOO=/var/log/odoo db: - image: postgres:9.6 + image: postgres:16.0 environment: - POSTGRES_PASSWORD=odoo - POSTGRES_USER=odoo - PGDATA=/var/lib/postgresql/data/pgdata volumes: - - odoo-db-data:/var/lib/postgresql/data/pgdata + - odoo16-db-data:/var/lib/postgresql/data/pgdata expose: - 5432 volumes: - odoo-web-data: - odoo-db-data: + odoo16-web-data: + odoo16-db-data: diff --git a/survey_answer_for_partner/README.rst b/survey_answer_for_partner/README.rst deleted file mode 100644 index 6b9f205..0000000 --- a/survey_answer_for_partner/README.rst +++ /dev/null @@ -1,45 +0,0 @@ -Survey Answer For Partner -========================= -This module enables filling a survey for someone else (likely a customer). - -Usage ------ -Go to the form view of a survey. - -Then click on the button `Answer Survey For`. - -.. image:: ./static/description/survey_form.png - -Select the partner for whom to answer the survey and click on `Validate`. - -.. image:: ./static/description/survey_select_partner_for.png - -Then, complete and send the survey. - -.. image:: ./static/description/survey_web_start.png - -Go back to the form view of the survey. Click on the `Answers` smart button. - -.. image:: ./static/description/survey_form_answers_smart_button.png - -Note that the new answer is in the name of the selected partner. - -.. image:: ./static/description/survey_form_answers_list.png - -Smart Button On Partners ------------------------- -On the form view of a partner, a `Survey Answers` smart button is added. - -.. image:: static/description/partner_smart_button.png - -When clicking on the button, the list of survey answers is displayed. - -.. image:: static/description/partner_smart_button_answers.png - -Contributors ------------- -* Numigi (tm) and all its contributors (https://bit.ly/numigiens) - -More information ----------------- -* Meet us at https://bit.ly/numigi-com diff --git a/survey_answer_for_partner/__init__.py b/survey_answer_for_partner/__init__.py deleted file mode 100644 index ac93395..0000000 --- a/survey_answer_for_partner/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import models -from . import wizard -from . import controllers \ No newline at end of file diff --git a/survey_answer_for_partner/__manifest__.py b/survey_answer_for_partner/__manifest__.py deleted file mode 100644 index 57de67a..0000000 --- a/survey_answer_for_partner/__manifest__.py +++ /dev/null @@ -1,23 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -{ - 'name': 'Survey Answer For Partner', - 'version': "14.0.1.0.0", - 'author': 'Numigi', - 'maintainer': 'Numigi', - 'website': 'https://bit.ly/numigi-com', - 'license': 'LGPL-3', - 'category': 'Survey', - 'summary': 'Allow answering a survey for someone else.', - 'depends': ['survey'], - 'data': [ - 'views/answer_create_user.xml', - 'wizard/answer_survey_for_wizard.xml', - 'views/answer_survey_for_button.xml', - 'views/fix_back_to_survey.xml', - 'views/partner_smart_button.xml', - "security/ir.model.access.csv", - ], - 'installable': True, -} diff --git a/survey_answer_for_partner/controllers/__init__.py b/survey_answer_for_partner/controllers/__init__.py deleted file mode 100644 index 1d380ac..0000000 --- a/survey_answer_for_partner/controllers/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from . import main \ No newline at end of file diff --git a/survey_answer_for_partner/controllers/main.py b/survey_answer_for_partner/controllers/main.py deleted file mode 100644 index ef35e7a..0000000 --- a/survey_answer_for_partner/controllers/main.py +++ /dev/null @@ -1,174 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from datetime import timedelta -from dateutil.relativedelta import relativedelta - -from odoo import http, _, fields -from odoo.addons.survey.controllers.main import Survey -from odoo.addons.base.models.ir_ui_view import keep_query -from odoo.exceptions import UserError -from odoo.http import request - - -class SurveyCustom(Survey): - - @http.route('/survey/partner/', type='http', auth='user', website=True) - def survey_partner(self, survey_token, answer_token=None, **kwargs): - """ Test mode for surveys: create a test answer, only for managers or officers - testing their surveys """ - survey_sudo, answer_sudo = self._fetch_from_access_token(survey_token, answer_token) - return request.redirect('/survey/start/partner/%s?%s' % (survey_sudo.access_token, keep_query('*', answer_token=answer_sudo.access_token))) - - @http.route('/survey/start/partner/', type='http', auth='public', website=True) - def survey_start_partner(self, survey_token, answer_token=None, email=False, **post): - """ Start a survey by providing - * a token linked to a survey; - * a token linked to an answer or generate a new token if access is allowed; - """ - # Get the current answer token from cookie - answer_from_cookie = False - if not answer_token: - answer_token = request.httprequest.cookies.get('survey_%s' % survey_token) - answer_from_cookie = bool(answer_token) - - access_data = self._get_access_data(survey_token, answer_token, ensure_token=False) - - if answer_from_cookie and access_data['validity_code'] == 'token_wrong': - # If the cookie had been generated for another user or does not correspond to any existing answer object - # (probably because it has been deleted), ignore it and redo the check. - # The cookie will be replaced by a legit value when resolving the URL, so we don't clean it further here. - access_data = self._get_access_data(survey_token, None, ensure_token=False) - if access_data['validity_code'] == 'token_wrong': - return self._redirect_with_error(access_data, access_data['validity_code']) - - survey_sudo, answer_sudo = access_data['survey_sudo'], access_data['answer_sudo'] - if not answer_sudo: - try: - answer_sudo = survey_sudo._create_answer(user=request.env.user, email=email) - except UserError: - answer_sudo = False - - if not answer_sudo: - try: - survey_sudo.with_user(request.env.user).check_access_rights('read') - survey_sudo.with_user(request.env.user).check_access_rule('read') - except: - return request.redirect("/") - else: - return request.render("survey.survey_403_page", {'survey': survey_sudo}) - - return request.redirect('/survey/partner/%s/%s' % (survey_sudo.access_token, answer_sudo.access_token)) - - @http.route('/survey/partner//', type='http', auth='public', website=True) - def survey_display_page_partner(self, survey_token, answer_token, **post): - access_data = self._get_access_data(survey_token, answer_token, ensure_token=True) - if access_data['validity_code'] == 'token_wrong': - return self._redirect_with_error(access_data, access_data['validity_code']) - - answer_sudo = access_data['answer_sudo'] - if answer_sudo.state != 'done' and answer_sudo.survey_time_limit_reached: - answer_sudo._mark_done() - - return request.render('survey.survey_page_fill', - self._prepare_survey_data(access_data['survey_sudo'], answer_sudo, **post)) - - @http.route('/survey/begin//', type='json', auth='public', website=True) - def survey_begin(self, survey_token, answer_token, **post): - """ Route used to start the survey user input and display the first survey page. """ - - access_data = self._get_access_data(survey_token, answer_token, ensure_token=True) - if access_data['validity_code'] == 'token_wrong': - return {'error': access_data['validity_code']} - survey_sudo, answer_sudo = access_data['survey_sudo'], access_data['answer_sudo'] - - if answer_sudo.state != "new": - return {'error': _("The survey has already started.")} - - answer_sudo._mark_in_progress() - return self._prepare_question_html(survey_sudo, answer_sudo, **post) - - @http.route('/survey/next_question//', type='json', auth='public', website=True) - def survey_next_question(self, survey_token, answer_token, **post): - """ Method used to display the next survey question in an ongoing session. - Triggered on all attendees screens when the host goes to the next question. """ - access_data = self._get_access_data(survey_token, answer_token, ensure_token=True) - if access_data['validity_code'] == 'token_wrong': - return {'error': access_data['validity_code']} - survey_sudo, answer_sudo = access_data['survey_sudo'], access_data['answer_sudo'] - - if answer_sudo.state == 'new' and answer_sudo.is_session_answer: - answer_sudo._mark_in_progress() - - return self._prepare_question_html(survey_sudo, answer_sudo, **post) - - @http.route('/survey/submit//', type='json', auth='public', website=True) - def survey_submit(self, survey_token, answer_token, **post): - """ Submit a page from the survey. - This will take into account the validation errors and store the answers to the questions. - If the time limit is reached, errors will be skipped, answers will be ignored and - survey state will be forced to 'done'""" - # Survey Validation - access_data = self._get_access_data(survey_token, answer_token, ensure_token=True) - if access_data['validity_code'] == 'token_wrong': - return {'error': access_data['validity_code']} - survey_sudo, answer_sudo = access_data['survey_sudo'], access_data['answer_sudo'] - - if answer_sudo.state == 'done': - return {'error': 'unauthorized'} - - questions, page_or_question_id = survey_sudo._get_survey_questions(answer=answer_sudo, - page_id=post.get('page_id'), - question_id=post.get('question_id')) - - if not answer_sudo.test_entry and not survey_sudo._has_attempts_left(answer_sudo.partner_id, answer_sudo.email, answer_sudo.invite_token): - # prevent cheating with users creating multiple 'user_input' before their last attempt - return {'error': 'unauthorized'} - - if answer_sudo.survey_time_limit_reached or answer_sudo.question_time_limit_reached: - if answer_sudo.question_time_limit_reached: - time_limit = survey_sudo.session_question_start_time + relativedelta( - seconds=survey_sudo.session_question_id.time_limit - ) - time_limit += timedelta(seconds=3) - else: - time_limit = answer_sudo.start_datetime + timedelta(minutes=survey_sudo.time_limit) - time_limit += timedelta(seconds=10) - if fields.Datetime.now() > time_limit: - # prevent cheating with users blocking the JS timer and taking all their time to answer - return {'error': 'unauthorized'} - - errors = {} - # Prepare answers / comment by question, validate and save answers - for question in questions: - inactive_questions = request.env['survey.question'] if answer_sudo.is_session_answer else answer_sudo._get_inactive_conditional_questions() - if question in inactive_questions: # if question is inactive, skip validation and save - continue - answer, comment = self._extract_comment_from_answers(question, post.get(str(question.id))) - errors.update(question.validate_question(answer, comment)) - if not errors.get(question.id): - answer_sudo.save_lines(question, answer, comment) - - if errors and not (answer_sudo.survey_time_limit_reached or answer_sudo.question_time_limit_reached): - return {'error': 'validation', 'fields': errors} - - if not answer_sudo.is_session_answer: - answer_sudo._clear_inactive_conditional_answers() - - if answer_sudo.survey_time_limit_reached or survey_sudo.questions_layout == 'one_page': - answer_sudo._mark_done() - elif 'previous_page_id' in post: - # Go back to specific page using the breadcrumb. Lines are saved and survey continues - return self._prepare_question_html(survey_sudo, answer_sudo, **post) - else: - vals = {'last_displayed_page_id': page_or_question_id} - if not answer_sudo.is_session_answer: - next_page = survey_sudo._get_next_page_or_question(answer_sudo, page_or_question_id) - if not next_page: - answer_sudo._mark_done() - - answer_sudo.write(vals) - - return self._prepare_question_html(survey_sudo, answer_sudo) - diff --git a/survey_answer_for_partner/i18n/fr.po b/survey_answer_for_partner/i18n/fr.po deleted file mode 100644 index 17999e7..0000000 --- a/survey_answer_for_partner/i18n/fr.po +++ /dev/null @@ -1,106 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * survey_answer_for_partner -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 12.0+e\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-03-26 18:51+0000\n" -"PO-Revision-Date: 2019-03-26 14:52-0400\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"Language: fr\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"X-Generator: Poedit 2.0.6\n" - -#. module: survey_answer_for_partner -#: model_terms:ir.ui.view,arch_db:survey_answer_for_partner.survey_form_with_answer_for_button -msgid "Answer Survey For" -msgstr "Répondre au sondage pour" - -#. module: survey_answer_for_partner -#: model_terms:ir.ui.view,arch_db:survey_answer_for_partner.view_answer_for_partner_wizard -msgid "Cancel" -msgstr "Annuler" - -#. module: survey_answer_for_partner -#: model:ir.model,name:survey_answer_for_partner.model_res_partner -msgid "Contact" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__create_uid -msgid "Created by" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__create_date -msgid "Created on" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__display_name -msgid "Display Name" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__id -msgid "ID" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard____last_update -msgid "Last Modified on" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__write_uid -msgid "Last Updated by" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__write_date -msgid "Last Updated on" -msgstr "" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__partner_id -msgid "Partner" -msgstr "Partenaire" - -#. module: survey_answer_for_partner -#: model:ir.actions.act_window,name:survey_answer_for_partner.action_answer_survey_for -#: model_terms:ir.ui.view,arch_db:survey_answer_for_partner.view_answer_for_partner_wizard -msgid "Select A Partner" -msgstr "Sélectionner un partenaire" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_survey_answer_for_partner_wizard__survey_id -msgid "Survey" -msgstr "Sondage" - -#. module: survey_answer_for_partner -#: model:ir.model,name:survey_answer_for_partner.model_survey_answer_for_partner_wizard -msgid "Survey Answer For Partner Wizard" -msgstr "Assistant répondre sondage pour partenaire" - -#. module: survey_answer_for_partner -#: model:ir.actions.act_window,name:survey_answer_for_partner.action_partner_survey_answers -#: model_terms:ir.ui.view,arch_db:survey_answer_for_partner.partner_form_with_survey_answers_button -msgid "Survey Answers" -msgstr "Réponses de sondage" - -#. module: survey_answer_for_partner -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_res_partner__survey_answers_count -#: model:ir.model.fields,field_description:survey_answer_for_partner.field_res_users__survey_answers_count -msgid "Survey Answers Count" -msgstr "Nombre réponses sondages" - -#. module: survey_answer_for_partner -#: model_terms:ir.ui.view,arch_db:survey_answer_for_partner.view_answer_for_partner_wizard -msgid "Validate" -msgstr "Valider" diff --git a/survey_answer_for_partner/models/__init__.py b/survey_answer_for_partner/models/__init__.py deleted file mode 100644 index f99714f..0000000 --- a/survey_answer_for_partner/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import partner_smart_button \ No newline at end of file diff --git a/survey_answer_for_partner/models/partner_smart_button.py b/survey_answer_for_partner/models/partner_smart_button.py deleted file mode 100644 index 2a40fa1..0000000 --- a/survey_answer_for_partner/models/partner_smart_button.py +++ /dev/null @@ -1,18 +0,0 @@ -# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import fields, models - - -class Partner(models.Model): - - _inherit = 'res.partner' - - survey_answers_count = fields.Integer( - compute='_compute_survey_answers_count') - - def _compute_survey_answers_count(self): - for partner in self: - partner.survey_answers_count = self.env['survey.user_input'].search([ - ('partner_id', 'child_of', partner.id), - ], count=True) diff --git a/survey_answer_for_partner/security/ir.model.access.csv b/survey_answer_for_partner/security/ir.model.access.csv deleted file mode 100644 index e70b10a..0000000 --- a/survey_answer_for_partner/security/ir.model.access.csv +++ /dev/null @@ -1,3 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_survey_answer_for_partner_wizard,access_survey_answer_for_partner_wizard,model_survey_answer_for_partner_wizard,survey.group_survey_user,1,1,1,0 - diff --git a/survey_answer_for_partner/static/description/icon.png b/survey_answer_for_partner/static/description/icon.png deleted file mode 100644 index 92a86b1..0000000 Binary files a/survey_answer_for_partner/static/description/icon.png and /dev/null differ diff --git a/survey_answer_for_partner/static/description/partner_smart_button.png b/survey_answer_for_partner/static/description/partner_smart_button.png deleted file mode 100644 index 0193498..0000000 Binary files a/survey_answer_for_partner/static/description/partner_smart_button.png and /dev/null differ diff --git a/survey_answer_for_partner/static/description/partner_smart_button_answers.png b/survey_answer_for_partner/static/description/partner_smart_button_answers.png deleted file mode 100644 index 6937d18..0000000 Binary files a/survey_answer_for_partner/static/description/partner_smart_button_answers.png and /dev/null differ diff --git a/survey_answer_for_partner/static/description/survey_form.png b/survey_answer_for_partner/static/description/survey_form.png deleted file mode 100644 index 24bf313..0000000 Binary files a/survey_answer_for_partner/static/description/survey_form.png and /dev/null differ diff --git a/survey_answer_for_partner/static/description/survey_form_answers_list.png b/survey_answer_for_partner/static/description/survey_form_answers_list.png deleted file mode 100644 index e7812f9..0000000 Binary files a/survey_answer_for_partner/static/description/survey_form_answers_list.png and /dev/null differ diff --git a/survey_answer_for_partner/static/description/survey_form_answers_smart_button.png b/survey_answer_for_partner/static/description/survey_form_answers_smart_button.png deleted file mode 100644 index 9747f87..0000000 Binary files a/survey_answer_for_partner/static/description/survey_form_answers_smart_button.png and /dev/null differ diff --git a/survey_answer_for_partner/static/description/survey_select_partner_for.png b/survey_answer_for_partner/static/description/survey_select_partner_for.png deleted file mode 100644 index c140bb4..0000000 Binary files a/survey_answer_for_partner/static/description/survey_select_partner_for.png and /dev/null differ diff --git a/survey_answer_for_partner/static/description/survey_web_start.png b/survey_answer_for_partner/static/description/survey_web_start.png deleted file mode 100644 index 0e5b9dd..0000000 Binary files a/survey_answer_for_partner/static/description/survey_web_start.png and /dev/null differ diff --git a/survey_answer_for_partner/tests/__init__.py b/survey_answer_for_partner/tests/__init__.py deleted file mode 100644 index 0ca2c59..0000000 --- a/survey_answer_for_partner/tests/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). diff --git a/survey_answer_for_partner/tests/test_answer_for_partner_wizard.py b/survey_answer_for_partner/tests/test_answer_for_partner_wizard.py deleted file mode 100644 index 8c59955..0000000 --- a/survey_answer_for_partner/tests/test_answer_for_partner_wizard.py +++ /dev/null @@ -1,28 +0,0 @@ -# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo.tests import common - - -class TestAnswerForPartnerWizard(common.SavepointCase): - - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.survey = cls.env.ref('survey.survey_feedback') - cls.partner = cls.env['res.partner'].create({'name': 'Partner'}) - cls.user = cls.env['res.users'].create({ - 'name': 'Test Surveys', - 'login': 'test_survey', - 'email': 'test_survey@test.com', - 'groups_id': [(4, cls.env.ref('survey.group_survey_user').id)], - }) - - def test_survey_input_has_the_selected_partner(self): - wizard = self.env['survey.answer.for.partner.wizard'].with_user(self.user).create({ - 'survey_id': self.survey.id, - 'partner_id': self.partner.id, - }) - wizard.sudo().action_validate() - last_answer = self.env['survey.user_input'].search([], order='create_date desc', limit=1) - assert last_answer.partner_id == self.partner diff --git a/survey_answer_for_partner/tests/test_partner_smart_button.py b/survey_answer_for_partner/tests/test_partner_smart_button.py deleted file mode 100644 index eeb8da7..0000000 --- a/survey_answer_for_partner/tests/test_partner_smart_button.py +++ /dev/null @@ -1,33 +0,0 @@ -# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo.tests import common - - -class TestPartnerSmartButton(common.SavepointCase): - - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.survey = cls.env.ref('survey.survey_feedback') - cls.partner_1 = cls.env['res.partner'].create({'name': 'Partner'}) - cls.partner_2 = cls.env['res.partner'].create({'name': 'Partner 2'}) - - @classmethod - def _generate_answer(cls, partner): - wizard = cls.env['survey.answer.for.partner.wizard'].create({ - 'survey_id': cls.survey.id, - 'partner_id': partner.id, - }) - wizard.action_validate() - - def test_survey_answers_count(self): - self._generate_answer(self.partner_1) - assert self.partner_1.survey_answers_count == 1 - assert self.partner_2.survey_answers_count == 0 - - def test_if_parent_partner__child_partner_surveys_included(self): - self.partner_1.parent_id = self.partner_2 - self._generate_answer(self.partner_1) - assert self.partner_1.survey_answers_count == 1 - assert self.partner_2.survey_answers_count == 1 diff --git a/survey_answer_for_partner/views/answer_create_user.xml b/survey_answer_for_partner/views/answer_create_user.xml deleted file mode 100644 index 25ff9f1..0000000 --- a/survey_answer_for_partner/views/answer_create_user.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - Survey Answer: Add Create User - survey.user_input - - - - - - - - - diff --git a/survey_answer_for_partner/views/answer_survey_for_button.xml b/survey_answer_for_partner/views/answer_survey_for_button.xml deleted file mode 100644 index 0bb76ff..0000000 --- a/survey_answer_for_partner/views/answer_survey_for_button.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Select A Partner - survey.answer.for.partner.wizard - form - - new - - - - Survey: Answer For Partner Button - survey.survey - - - - - -
- -
- - -
-
- -
diff --git a/survey_answer_for_partner/views/fix_back_to_survey.xml b/survey_answer_for_partner/views/fix_back_to_survey.xml deleted file mode 100644 index cd3c04b..0000000 --- a/survey_answer_for_partner/views/fix_back_to_survey.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - diff --git a/survey_answer_for_partner/views/partner_smart_button.xml b/survey_answer_for_partner/views/partner_smart_button.xml deleted file mode 100644 index f2d26b0..0000000 --- a/survey_answer_for_partner/views/partner_smart_button.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - Survey Answers - survey.user_input - list,form - current - [('partner_id', 'child_of', active_id)] - - - - Partner Form: Add survey answers smart button - res.partner - - -
- -
-
-
- -
diff --git a/survey_answer_for_partner/wizard/__init__.py b/survey_answer_for_partner/wizard/__init__.py deleted file mode 100644 index 847fbe6..0000000 --- a/survey_answer_for_partner/wizard/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import answer_survey_for_wizard \ No newline at end of file diff --git a/survey_answer_for_partner/wizard/answer_survey_for_wizard.py b/survey_answer_for_partner/wizard/answer_survey_for_wizard.py deleted file mode 100644 index 1093d74..0000000 --- a/survey_answer_for_partner/wizard/answer_survey_for_wizard.py +++ /dev/null @@ -1,40 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -import logging - -import werkzeug -from odoo import fields, models - -_logger = logging.getLogger(__name__) - -""" -The type of survey input should be `manually` in this module's use case. - -If the input is created, but the user quits before sending the answers, -it will be garbage collected by a cron automatically. -""" - - -class SurveyAnswerForPartnerWizard(models.TransientModel): - _name = 'survey.answer.for.partner.wizard' - _description = 'Survey Answer For Partner Wizard' - - survey_id = fields.Many2one('survey.survey', 'Survey') - partner_id = fields.Many2one('res.partner', 'Partner') - - def action_validate(self): - user = self.env.user - public_groups = self.env.ref("base.group_public", raise_if_not_found=False) - if public_groups: - public_users = public_groups.sudo().with_context(active_test=False).mapped("users") - user = public_users[0] - user_input_id = self.survey_id.sudo()._create_answer(user=user, partner=self.partner_id) - url1 = '/survey/partner/%s' % self.survey_id.access_token - url = '%s?%s' % ( - url1, werkzeug.urls.url_encode({'answer_token': user_input_id and user_input_id.access_token or None})) - return { - 'type': 'ir.actions.act_url', - 'name': "Start Survey", - 'target': 'self', - 'url': url, - } diff --git a/survey_answer_for_partner/wizard/answer_survey_for_wizard.xml b/survey_answer_for_partner/wizard/answer_survey_for_wizard.xml deleted file mode 100644 index 5c52798..0000000 --- a/survey_answer_for_partner/wizard/answer_survey_for_wizard.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Answer Survey For Partner Wizard - survey.answer.for.partner.wizard - -
- - - - -
-
-
-
-
- -
diff --git a/survey_type/README.rst b/survey_type/README.rst deleted file mode 100644 index ad8e688..0000000 --- a/survey_type/README.rst +++ /dev/null @@ -1,18 +0,0 @@ -Survey Type -=========== -This module adds `Survey Types`. - -A survey type is selectable on a survey. - -.. image:: /survey_type/static/description/survey_form.png - - -To edit the list of available survey types, go to `Survey / Configuration / Survey Types`. - -.. image:: /survey_type/static/description/survey_type_list.png - -Users with the `Survey / Manager` access rights can see the list of surveys. - -Contributors ------------- -* Numigi (tm) and all its contributors (https://bit.ly/numigiens) diff --git a/survey_type/__init__.py b/survey_type/__init__.py deleted file mode 100644 index a6d2238..0000000 --- a/survey_type/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import models diff --git a/survey_type/__manifest__.py b/survey_type/__manifest__.py deleted file mode 100644 index baa359c..0000000 --- a/survey_type/__manifest__.py +++ /dev/null @@ -1,19 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -{ - 'name': 'Survey Type', - 'version': "14.0.1.0.0", - 'author': 'Numigi', - 'maintainer': 'Numigi', - 'license': 'LGPL-3', - 'category': 'Survey', - 'summary': 'Enable typing a survey.', - 'depends': ['survey'], - 'data': [ - 'views/survey.xml', - 'views/survey_type.xml', - 'security/ir.model.access.csv', - ], - 'installable': True, -} diff --git a/survey_type/i18n/fr.po b/survey_type/i18n/fr.po deleted file mode 100644 index f05ed0f..0000000 --- a/survey_type/i18n/fr.po +++ /dev/null @@ -1,86 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * hr_working_space -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0+e\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-23 17:47+0000\n" -"PO-Revision-Date: 2019-01-23 12:47-0500\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"Language: fr\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"X-Generator: Poedit 2.0.6\n" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__active -msgid "Active" -msgstr "Actif" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__create_uid -msgid "Created by" -msgstr "Créé par" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__create_date -msgid "Created on" -msgstr "Créé le" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__display_name -msgid "Display Name" -msgstr "Nom à afficher" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__id -msgid "ID" -msgstr "ID" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type____last_update -msgid "Last Modified on" -msgstr "Dernière modification le" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__write_uid -msgid "Last Updated by" -msgstr "Dernière mise à jour par" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__write_date -msgid "Last Updated on" -msgstr "Dernière mise à jour le" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_type__name -msgid "Name" -msgstr "Nom" - -#. module: survey_type -#: model:ir.model,name:survey_type.model_survey_survey -msgid "Survey" -msgstr "Sondage" - -#. module: survey_type -#: model:ir.model,name:survey_type.model_survey_type -#: model_terms:ir.ui.view,arch_db:survey_type.view_survey_type_form -msgid "Survey Type" -msgstr "Types de sondages" - -#. module: survey_type -#: model:ir.actions.act_window,name:survey_type.action_survey_type -#: model:ir.ui.menu,name:survey_type.menu_survey_type -#: model_terms:ir.ui.view,arch_db:survey_type.view_survey_type_list -msgid "Survey Types" -msgstr "Types de sondages" - -#. module: survey_type -#: model:ir.model.fields,field_description:survey_type.field_survey_survey__type_id -msgid "Type" -msgstr "Type" diff --git a/survey_type/models/__init__.py b/survey_type/models/__init__.py deleted file mode 100644 index 7a319b0..0000000 --- a/survey_type/models/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from . import ( - survey, - survey_type, -) diff --git a/survey_type/models/survey.py b/survey_type/models/survey.py deleted file mode 100644 index 74d1a6a..0000000 --- a/survey_type/models/survey.py +++ /dev/null @@ -1,11 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import fields, models - - -class SurveyWithType(models.Model): - - _inherit = "survey.survey" - - type_id = fields.Many2one("survey.type", "Type", ondelete="restrict") diff --git a/survey_type/models/survey_type.py b/survey_type/models/survey_type.py deleted file mode 100644 index 75c8420..0000000 --- a/survey_type/models/survey_type.py +++ /dev/null @@ -1,13 +0,0 @@ -# © 2022 Numigi (tm) and all its contributors (https://bit.ly/numigiens) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -from odoo import fields, models - - -class SurveyType(models.Model): - - _name = "survey.type" - _description = "Survey Type" - - name = fields.Char(required=True, translate=True) - active = fields.Boolean(default=True) diff --git a/survey_type/security/ir.model.access.csv b/survey_type/security/ir.model.access.csv deleted file mode 100644 index 5e5e1ef..0000000 --- a/survey_type/security/ir.model.access.csv +++ /dev/null @@ -1,3 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_survey_type,access_survey_type,model_survey_type,base.group_user,1,0,0,0 -access_survey_type_manager,access_survey_type,model_survey_type,survey.group_survey_manager,1,1,1,1 diff --git a/survey_type/static/description/icon.png b/survey_type/static/description/icon.png deleted file mode 100644 index 92a86b1..0000000 Binary files a/survey_type/static/description/icon.png and /dev/null differ diff --git a/survey_type/static/description/survey_form.png b/survey_type/static/description/survey_form.png deleted file mode 100644 index 2f43a0d..0000000 Binary files a/survey_type/static/description/survey_form.png and /dev/null differ diff --git a/survey_type/static/description/survey_type_list.png b/survey_type/static/description/survey_type_list.png deleted file mode 100644 index af8e0b6..0000000 Binary files a/survey_type/static/description/survey_type_list.png and /dev/null differ diff --git a/survey_type/views/survey.xml b/survey_type/views/survey.xml deleted file mode 100644 index 1a9a206..0000000 --- a/survey_type/views/survey.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Survey Form: Add type - survey.survey - - - - - - - - - - - - Survey List: Add type - survey.survey - - - - - - - - - - Survey Search View: Add type - survey.survey - - - - - - - - - diff --git a/survey_type/views/survey_type.xml b/survey_type/views/survey_type.xml deleted file mode 100644 index 03065a0..0000000 --- a/survey_type/views/survey_type.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Survey Type Form - survey.type - - -
- -
-

- -

-
- - - -
-
-
-
- - - Survey Type List - survey.type - - - - - - - - - - - Survey Types - survey.type - ir.actions.act_window - list,form - - - - -