diff --git a/setup/survey_certification_program/odoo/addons/survey_certification_program b/setup/survey_certification_program/odoo/addons/survey_certification_program new file mode 120000 index 00000000..09e35052 --- /dev/null +++ b/setup/survey_certification_program/odoo/addons/survey_certification_program @@ -0,0 +1 @@ +../../../../survey_certification_program \ No newline at end of file diff --git a/setup/survey_certification_program/setup.py b/setup/survey_certification_program/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/survey_certification_program/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/survey_certification_program/README.rst b/survey_certification_program/README.rst new file mode 100644 index 00000000..6f1e05a2 --- /dev/null +++ b/survey_certification_program/README.rst @@ -0,0 +1,91 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============================ +Survey Certification Program +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:33adc28b375b98a6cac97a21f6d46ff997431e6baa8b9adaf79a4f471ebaf788 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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/16.0/survey_certification_program + :alt: OCA/survey +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/survey-16-0/survey-16-0-survey_certification_program + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/survey&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows certificates generated from the Survey module to +optionally include a second page listing the assessed content. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +1. Go to the **Surveys** app. +2. Open an existing survey or create a new one. +3. In the survey form, click on the **Options** tab. +4. Click **Certification Program**. +5. Set your program lines by survey. +6. Print any certificate. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Binhex + +Contributors +------------ + +- Abraham J. Febres a.febres@binhex.cloud (https://binhex.cloud) + +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. + +This module is part of the `OCA/survey `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/survey_certification_program/__init__.py b/survey_certification_program/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/survey_certification_program/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/survey_certification_program/__manifest__.py b/survey_certification_program/__manifest__.py new file mode 100644 index 00000000..9aeb8fa8 --- /dev/null +++ b/survey_certification_program/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2025 Binhex +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Survey Certification Program", + "summary": ( + """This module add an optional certification program page to survey certificates.""" + ), + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Binhex,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/survey", + "depends": ["survey"], + "data": [ + "security/ir.model.access.csv", + "views/survey_survey_views.xml", + "report/survey_report_templates.xml", + ], + "assets": { + "web.report_assets_common": [ + "survey_certification_program/static/src/scss/survey_reports.scss", + ], + }, +} diff --git a/survey_certification_program/i18n/es.po b/survey_certification_program/i18n/es.po new file mode 100644 index 00000000..6dc7b480 --- /dev/null +++ b/survey_certification_program/i18n/es.po @@ -0,0 +1,153 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * survey_certification_program +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-05-18 10:18+0000\n" +"PO-Revision-Date: 2026-05-18 10:18+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: survey_certification_program +#: model:ir.model.fields,help:survey_certification_program.field_survey_survey__certification_program_layout +msgid "" +"1. Simple list: The program blocks will be displayed one below the other in a vertical layout.\n" +"2. In columns: The program blocks will be displayed in a table.\n" +msgstr "1.Limple: los bloques del programa se mostrarán uno debajo del otro en un diseño de lista.\n" +"2. En columnas: los bloques del programa se mostrarán en una tabla.\n" + +#. module: survey_certification_program +#: model:ir.model.fields,help:survey_certification_program.field_survey_survey__certification_program_enabled +msgid "Allows you to enable program lines" +msgstr "Permite habilitar las líneas del programa" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_survey__certification_program_layout +msgid "Certificate Layout" +msgstr "Diseño del certificado" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_survey__certification_program_enabled +msgid "Certification Program" +msgstr "Programa de certificación" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_survey__certificate_program_line_ids +msgid "Certification Program Lines" +msgstr "Líneas del programa de certificación" + +#. module: survey_certification_program +#: model_terms:ir.ui.view,arch_db:survey_certification_program.survey_survey_view_form +msgid "Certification Programs" +msgstr "Programas de certificación" + +#. module: survey_certification_program +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_classic +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_modern +msgid "Certification n°" +msgstr "Certificación n°" + +#. module: survey_certification_program +#: model:ir.model.fields.selection,name:survey_certification_program.selection__survey_survey__certification_program_layout__columns +msgid "Columns" +msgstr "Columnas" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__create_uid +msgid "Created by" +msgstr "" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__create_date +msgid "Created on" +msgstr "" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__description +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_classic +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_modern +msgid "Description" +msgstr "Descripción" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__display_name +msgid "Display Name" +msgstr "" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__hours +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_classic +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_modern +msgid "Hours" +msgstr "Horas" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__id +msgid "ID" +msgstr "" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__write_date +msgid "Last Updated on" +msgstr "" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__name +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_classic +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_modern +msgid "Name" +msgstr "Nombre" + +#. module: survey_certification_program +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_classic +#: model_terms:ir.ui.view,arch_db:survey_certification_program.certification_report_view_modern +msgid "Program" +msgstr "Programa" + +#. module: survey_certification_program +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__sequence +msgid "Sequence" +msgstr "Secuencia" + +#. module: survey_certification_program +#: model:ir.model.fields.selection,name:survey_certification_program.selection__survey_survey__certification_program_layout__simple +msgid "Simple" +msgstr "Simple" + +#. module: survey_certification_program +#: model:ir.model,name:survey_certification_program.model_survey_survey +#: model:ir.model.fields,field_description:survey_certification_program.field_survey_certificate_program_line__survey_id +msgid "Survey" +msgstr "Encuesta" + +#. module: survey_certification_program +#: model:ir.model,name:survey_certification_program.model_survey_certificate_program_line +msgid "Survey Certificate Program Line" +msgstr "Línea del Programa de Certificación" + +#. module: survey_certification_program +#: model:ir.model.fields,help:survey_certification_program.field_survey_survey__certificate_program_line_ids +msgid "The certification program lines associated with this survey." +msgstr "Las líneas del programa de certificación asociadas con esta encuesta." + +#. module: survey_certification_program +#: model:ir.model.fields,help:survey_certification_program.field_survey_certificate_program_line__survey_id +msgid "The survey associated with this certification program line." +msgstr "La encuesta asociada con esta línea del programa de certificación." diff --git a/survey_certification_program/models/__init__.py b/survey_certification_program/models/__init__.py new file mode 100644 index 00000000..f66622bb --- /dev/null +++ b/survey_certification_program/models/__init__.py @@ -0,0 +1,2 @@ +from . import survey_certification_program +from . import survey diff --git a/survey_certification_program/models/survey.py b/survey_certification_program/models/survey.py new file mode 100644 index 00000000..953996d1 --- /dev/null +++ b/survey_certification_program/models/survey.py @@ -0,0 +1,31 @@ +# Copyright 2026 Binhex +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SurveySurvey(models.Model): + _inherit = "survey.survey" + + certification_program_enabled = fields.Boolean( + string="Certification Program", + help="Allows you to enable program lines", + ) + certificate_program_line_ids = fields.One2many( + "survey.certificate.program.line", + "survey_id", + string="Certification Program Lines", + help="The certification program lines associated with this survey.", + ) + certification_program_layout = fields.Selection( + [ + ("simple", "Simple"), + ("columns", "Columns"), + ], + default="simple", + string="Certificate Layout", + help="""1. Simple list: The program blocks will be displayed one below the other +in a vertical layout. +2. In columns: The program blocks will be displayed in a table. +""", + ) diff --git a/survey_certification_program/models/survey_certification_program.py b/survey_certification_program/models/survey_certification_program.py new file mode 100644 index 00000000..6bb7adc8 --- /dev/null +++ b/survey_certification_program/models/survey_certification_program.py @@ -0,0 +1,23 @@ +# Copyright 2026 Binhex +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SurveyCertificateProgramLine(models.Model): + _name = "survey.certificate.program.line" + _description = "Survey Certificate Program Line" + _order = "sequence" + + survey_id = fields.Many2one( + "survey.survey", + string="Survey", + help="The survey associated with this certification program line.", + required=True, + ondelete="cascade", + index=True, + ) + sequence = fields.Integer(default=10) + name = fields.Char(required=True) + description = fields.Html() + hours = fields.Float() diff --git a/survey_certification_program/readme/CONTRIBUTORS.md b/survey_certification_program/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..060f1075 --- /dev/null +++ b/survey_certification_program/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Abraham J. Febres (https://binhex.cloud) diff --git a/survey_certification_program/readme/DESCRIPTION.md b/survey_certification_program/readme/DESCRIPTION.md new file mode 100644 index 00000000..b43fab07 --- /dev/null +++ b/survey_certification_program/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows certificates generated from the Survey module to optionally +include a second page listing the assessed content. diff --git a/survey_certification_program/readme/USAGE.md b/survey_certification_program/readme/USAGE.md new file mode 100644 index 00000000..4b290b5d --- /dev/null +++ b/survey_certification_program/readme/USAGE.md @@ -0,0 +1,6 @@ +1. Go to the **Surveys** app. +2. Open an existing survey or create a new one. +3. In the survey form, click on the **Options** tab. +4. Click **Certification Program**. +5. Set your program lines by survey. +6. Print any certificate. diff --git a/survey_certification_program/report/survey_report_templates.xml b/survey_certification_program/report/survey_report_templates.xml new file mode 100644 index 00000000..cc4518b6 --- /dev/null +++ b/survey_certification_program/report/survey_report_templates.xml @@ -0,0 +1,172 @@ + + + + + + + diff --git a/survey_certification_program/security/ir.model.access.csv b/survey_certification_program/security/ir.model.access.csv new file mode 100644 index 00000000..fa9dff30 --- /dev/null +++ b/survey_certification_program/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_survey_certification_program_line,access.survey.certification.program.line,model_survey_certificate_program_line,base.group_user,1,1,1,1 diff --git a/survey_certification_program/static/description/index.html b/survey_certification_program/static/description/index.html new file mode 100644 index 00000000..b3354f43 --- /dev/null +++ b/survey_certification_program/static/description/index.html @@ -0,0 +1,442 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Survey Certification Program

+ +

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

+

This module allows certificates generated from the Survey module to +optionally include a second page listing the assessed content.

+

Table of contents

+ +
+

Usage

+
    +
  1. Go to the Surveys app.
  2. +
  3. Open an existing survey or create a new one.
  4. +
  5. In the survey form, click on the Options tab.
  6. +
  7. Click Certification Program.
  8. +
  9. Set your program lines by survey.
  10. +
  11. Print any certificate.
  12. +
+
+
+

Bug Tracker

+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Binhex
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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

+

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

+

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

+
+
+
+
+ + diff --git a/survey_certification_program/static/src/scss/survey_reports.scss b/survey_certification_program/static/src/scss/survey_reports.scss new file mode 100644 index 00000000..394b05b8 --- /dev/null +++ b/survey_certification_program/static/src/scss/survey_reports.scss @@ -0,0 +1,292 @@ +#o_survey_certification_program.certification-wrapper { + background-color: #875a7b; + position: relative; + display: flex; + margin-left: -4mm; + margin-right: -4mm; + + &.blue { + background-color: #263e86; + } + + &.gold { + background-color: #d7a520; + } + + .test-entry { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: url(/survey/static/src/img/watermark.png); + background-size: 20%; + background-position: center; + z-index: 4; + } + + .certification { + position: relative; + text-align: center; + + .certification-failed p { + margin-top: 30mm; + } + + .certification-seal { + position: absolute; + background-size: 100%; + } + + .certification-top { + h1 { + font-size: 52pt; + text-transform: uppercase; + line-height: 24pt; + + span { + font-size: 20pt; + } + } + } + + .certification-content { + p { + font-size: 16pt; + color: #6b6d70; + + .user-name { + font-family: certification-cursive, cursive; + font-size: 50pt; + line-height: 2; + color: #282f33; + border-bottom: 1pt solid #282f33; + } + + .certification-name { + font-size: 18pt; + line-height: 1.5; + text-transform: uppercase; + color: #282f33; + } + } + } + + .certification-bottom { + position: absolute; + bottom: 15mm; + + .certification-date-wrapper { + width: 80mm; + padding: 10mm; + text-align: center; + + .certification-date { + border-bottom: 1pt solid #282f33; + } + } + + .certification-company { + position: absolute; + top: 0; + bottom: 0; + width: 33%; + text-align: center; + + img { + max-width: 100%; + max-height: 100%; + } + } + } + .certification-number { + color: #6b6d70; + position: absolute; + font-size: 10pt; + } + } + + // Classic Template + &.classic { + &.blue .certification { + color: #263e86; + + .certification-top { + &:before, + &:after { + background-image: url("/survey/static/src/img/classic-ornament-blue.svg"); + } + } + + .certification-content p .certification-name { + color: #263e86; + } + } + + &.gold .certification { + color: #d7a520; + + .certification-top { + &:before, + &:after { + background-image: url("/survey/static/src/img/classic-ornament-gold.svg"); + } + } + .certification-content p .certification-name { + color: #d7a520; + } + } + + .certification { + background-image: url("/survey/static/src/img/certification_bg_classic.svg"); + background-repeat: no-repeat; + background-size: cover; + font-family: "certification-serif", serif; + width: 295mm; + height: 208mm; + margin: 1mm; + color: #875a7b; + + .certification-top { + padding-top: 10mm; + + &:before, + &:after { + content: ""; + display: block; + width: 108mm; + height: 16mm; + margin: 0 auto; + background-image: url("/survey/static/src/img/classic-ornament-purple.svg"); + background-repeat: no-repeat; + } + + &:before { + margin-bottom: 10mm; + } + + &:after { + -webkit-transform: scaleY(-1); + transform: scaleY(-1); + margin-bottom: 5mm; + } + } + .certification-content { + margin-bottom: 10mm; + + p .certification-name { + color: #875a7b; + } + } + + .certification-bottom { + width: 295mm; + bottom: 20mm; + + .certification-date-wrapper { + margin-left: 40mm; + font-size: 18pt; + color: #6b6d70; + + span { + font-size: 18pt; + } + } + + .certification-seal { + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + width: 24mm; + height: 24mm; + background: url(/survey/static/src/img/classic-seal.png) no-repeat; + } + + .certification-company { + padding-left: 10mm; + right: 35mm; + } + + .certification-number { + bottom: -15mm; + left: 50%; + -webkit-transform: translateX(-50%); + transform: translateX(-50%); + } + } + } + } + + // Modern Template + &.modern { + background-image: url("/survey/static/src/img/certification_bg_modern.svg"); + background-repeat: no-repeat; + background-size: cover; + + &.blue .certification .certification-seal { + background-image: url("/survey/static/src/img/modern-seal-blue.svg"); + } + + &.gold .certification .certification-seal { + background-image: url("/survey/static/src/img/modern-seal-gold.svg"); + } + + .certification { + font-family: "certification-modern", sans-serif; + width: 272mm; + height: 185mm; + margin: 12.5mm; + background-color: #f2f2f2; + text-align: center; + + .certification-seal { + top: -7mm; + right: 20mm; + width: 22mm; + height: 42mm; + background-image: url("/survey/static/src/img/modern-seal-purple.svg"); + background-repeat: no-repeat; + } + + .certification-top { + padding-top: 28mm; + padding-bottom: 10mm; + color: #282f33; + + h1 b { + font-weight: bold; + } + } + + .certification-bottom { + width: 272mm; + + .certification-date-wrapper { + margin-left: 40mm; + text-transform: uppercase; + + .certification-date { + font-size: 18pt; + color: #282f33; + } + + span { + font-size: 14pt; + color: #6b6d70; + } + } + + .certification-company { + right: 30mm; + } + } + + .certification-number { + bottom: -6mm; + right: 0; + text-align: right; + } + } + } +} diff --git a/survey_certification_program/tests/__init__.py b/survey_certification_program/tests/__init__.py new file mode 100644 index 00000000..e6fa1d57 --- /dev/null +++ b/survey_certification_program/tests/__init__.py @@ -0,0 +1 @@ +from . import test_survey_certification_program diff --git a/survey_certification_program/tests/test_survey_certification_program.py b/survey_certification_program/tests/test_survey_certification_program.py new file mode 100644 index 00000000..cb735bf8 --- /dev/null +++ b/survey_certification_program/tests/test_survey_certification_program.py @@ -0,0 +1,96 @@ +from odoo.fields import Command +from odoo.tests.common import tagged + +from odoo.addons.survey.tests import common + + +@tagged("-at_install", "post_install") +class TestSurveyCertificationProgram(common.TestSurveyCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.program_line1 = { + "sequence": 1, + "name": "Program Line 1", + "description": "

Program Line 1 Description

", + "hours": 1.0, + } + cls.program_line2 = { + "sequence": 2, + "name": "Program Line 2", + "description": "

Program Line 2 Description

", + "hours": 2.0, + } + + def _assert_report_rendering(self, user_input): + report = self.env.ref("survey.certification_report") + res = str(report._render_qweb_html(report.id, user_input.ids)[0]) + certification = user_input.survey_id + if certification.certification_program_enabled: + self.assertIn("Program Line 1", res) + self.assertIn("Program Line 2", res) + else: + self.assertNotIn("Program Line 1", res) + self.assertNotIn("Program Line 2", res) + + def test_program_table_flow_and_certification_report_rendering(self): + with self.with_user("survey_user"): + certification = self.env["survey.survey"].create( + { + "title": "Certification Test", + "certification": True, + "certification_program_enabled": True, + "certificate_program_line_ids": [ + Command.create(self.program_line1), + Command.create(self.program_line2), + ], + "certification_program_layout": "simple", + "access_mode": "public", + "users_login_required": True, + "questions_layout": "page_per_question", + "scoring_type": "scoring_with_answers", + "scoring_success_min": 1, + } + ) + + q01 = self._add_question( + None, + "Q1", + "simple_choice", + sequence=1, + constr_mandatory=True, + constr_error_msg="Please select an answer", + survey_id=certification.id, + labels=[ + {"value": "Wrong answer"}, + { + "value": "Correct answer!!!", + "is_correct": True, + "answer_score": 2.0, + }, + ], + ) + + user_input = self._add_answer(certification, self.survey_user.partner_id) + self._add_answer_line( + q01, + user_input, + q01.suggested_answer_ids[-1]["id"], + ) + + user_input.state = "done" + + # test certification program simple report rendering + self.assertEqual( + certification.certification_program_layout, + "simple", + ) + self._assert_report_rendering(user_input) + + # test certification program columns report rendering + certification.certification_program_layout = "columns" + self.assertEqual( + certification.certification_program_layout, + "columns", + ) + self._assert_report_rendering(user_input) diff --git a/survey_certification_program/views/survey_survey_views.xml b/survey_certification_program/views/survey_survey_views.xml new file mode 100644 index 00000000..59b1b407 --- /dev/null +++ b/survey_certification_program/views/survey_survey_views.xml @@ -0,0 +1,44 @@ + + + + + survey.survey.view.form.inherit + survey.survey + + + + + + + + + + + + + + + + + + + + + + + +