Browse Source

[ADD] survey_pass_fail_messages

16.0
RemiFr82 14 hours ago
parent
commit
2d99ccdc6a
  1. 1
      survey_pass_fail_messages/__init__.py
  2. 40
      survey_pass_fail_messages/__manifest__.py
  3. 77
      survey_pass_fail_messages/i18n/fr.po
  4. 1
      survey_pass_fail_messages/models/__init__.py
  5. 17
      survey_pass_fail_messages/models/survey_survey.py
  6. 25
      survey_pass_fail_messages/views/survey_survey.xml
  7. 15
      survey_pass_fail_messages/views/survey_templates.xml

1
survey_pass_fail_messages/__init__.py

@ -0,0 +1 @@
from . import models

40
survey_pass_fail_messages/__manifest__.py

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Survey score message",
"version": "1.0.0",
"summary": """
Add score specific message to survey done page
""",
"description": """
This module adds 2 text fiels on surveys that are displayed according to the succes (or fail) regarding the score.
""",
"author": "RemiFr82",
"contributors": "",
"maintainer": "RemiFr82",
"website": "https://remifr82.me",
"license": "LGPL-3",
"category": "Marketing",
# "price": 0,
# "currency": "EUR",
"application": False,
"installable": True,
"auto_install": False,
"pre_init_hook": "",
"post_init_hook": "",
"uninstall_hook": "",
"excludes": [],
"external_dependencies": [],
"depends": [
"survey",
],
"data": [
"views/survey_survey.xml",
"views/survey_templates.xml",
],
"css": [],
"images": [],
"js": [],
"test": [],
"demo": [],
}

77
survey_pass_fail_messages/i18n/fr.po

@ -0,0 +1,77 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * survey_pass_fail_messages
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0-20230613\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-22 14:49+0000\n"
"PO-Revision-Date: 2024-12-22 14:49+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_pass_fail_messages
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form
msgid ""
"Certification failed end message (following the standard \"Unfortunately, "
"you have failed the test.\" message)"
msgstr ""
"Message de fin en cas d'échec (inséré après le message \"Malheureusement, "
"vous avez raté le test.\")"
#. module: survey_pass_fail_messages
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form
msgid ""
"Certification passed end message (following the standard \"Congratulations, "
"you have passed the test!\" message)"
msgstr ""
"Message de fin en cas de réussite (inséré après le message \"Félicitations, "
"vous avez réussi le test !\")"
#. module: survey_pass_fail_messages
#: model:ir.model.fields,field_description:survey_pass_fail_messages.field_survey_survey__description_done_fail
msgid "Failed end message"
msgstr "Message d'échec"
#. module: survey_pass_fail_messages
#: model:ir.model.fields,field_description:survey_pass_fail_messages.field_survey_survey__description_done_pass
msgid "Passed end message"
msgstr "Message de réussite"
#. module: survey_pass_fail_messages
#: model:ir.model,name:survey_pass_fail_messages.model_survey_survey
msgid "Survey"
msgstr "Sondage"
#. module: survey_pass_fail_messages
#: model:ir.model.fields,help:survey_pass_fail_messages.field_survey_survey__description_done_fail
msgid ""
"This message will be displayed when survey is completed and the user failed "
"the test."
msgstr ""
"Ce message sera affiché quand le sondage est terminé si l'utilisateur rate "
"le test."
#. module: survey_pass_fail_messages
#: model:ir.model.fields,help:survey_pass_fail_messages.field_survey_survey__description_done_pass
msgid ""
"This message will be displayed when survey is completed and the user passed "
"the test."
msgstr ""
"Ce message sera affiché quand le sondage est terminé si l'utilisateur "
"réussit le test."
#. module: survey_pass_fail_messages
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form
msgid "e.g. \"Passing the test gives you the possibility to...\""
msgstr "ex. \"Réussir ce test vous permet de...\""
#. module: survey_pass_fail_messages
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form
msgid "e.g. \"You can retry this test after...\""
msgstr "ex. \"Vous pourrez retenter ce test après...\""

1
survey_pass_fail_messages/models/__init__.py

@ -0,0 +1 @@
from . import survey_survey

17
survey_pass_fail_messages/models/survey_survey.py

@ -0,0 +1,17 @@
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class SurveySurvey(models.Model):
_inherit = "survey.survey"
description_done_pass = fields.Html(
string="Passed end message",
translate=True,
help="This message will be displayed when survey is completed and the user passed the test.",
)
description_done_fail = fields.Html(
string="Failed end message",
translate=True,
help="This message will be displayed when survey is completed and the user failed the test.",
)

25
survey_pass_fail_messages/views/survey_survey.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- survey views and actions -->
<record id="survey_survey_form" model="ir.ui.view">
<field name="name">survey_template survey.survey form</field>
<field name="model">survey.survey</field>
<field name="inherit_id" ref="survey.survey_survey_view_form" />
<field name="priority">22</field>
<field name="arch" type="xml">
<field name="description_done" position="after">
<label for="description_done_pass" attrs="{'invisible':[('scoring_type','=','no_scoring')]}"
string="Certification passed end message (following the standard &quot;Congratulations, you have passed the test!&quot; message)" />
<field name="description_done_pass" attrs="{'invisible':[('scoring_type','=','no_scoring')]}"
placeholder="e.g. &quot;Passing the test gives you the possibility to...&quot;" />
<label for="description_done_fail" attrs="{'invisible':[('scoring_type','=','no_scoring')]}"
string="Certification failed end message (following the standard &quot;Unfortunately, you have failed the test.&quot; message)" />
<field name="description_done_fail" attrs="{'invisible':[('scoring_type','=','no_scoring')]}"
placeholder="e.g. &quot;You can retry this test after...&quot;" />
</field>
</field>
</record>
</odoo>

15
survey_pass_fail_messages/views/survey_templates.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="survey_fill_form_done" name="Survey: finished score" inherit_id="survey.survey_fill_form_done">
<xpath expr="//t[@t-if='answer.scoring_success']/div[1]" position="after">
<div t-field="survey.description_done_pass" class="oe_no_empty" />
</xpath>
<xpath expr="//t[@t-else='']/div[1]" position="after">
<div t-field="survey.description_done_fail" class="oe_no_empty" />
</xpath>
</template>
</data>
</odoo>
Loading…
Cancel
Save