Skip to content

Commit

Permalink
[MIG] survey_question_type_five_star: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
baimont committed Jan 19, 2023
1 parent eecad87 commit cf1602c
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 100 deletions.
6 changes: 6 additions & 0 deletions setup/survey_question_type_five_star/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
32 changes: 12 additions & 20 deletions survey_question_type_five_star/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ Survey five stars question type
: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/14.0/survey_question_type_five_star
:target: https://github.com/OCA/survey/tree/16.0/survey_question_type_five_star
:alt: OCA/survey
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/survey-14-0/survey-14-0-survey_question_type_five_star
:target: https://translation.odoo-community.org/projects/survey-16-0/survey-16-0-survey_question_type_five_star
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/200/14.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/survey&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module add five stars rating question type for survey page
This module adds five stars rating question type for survey page

**Table of contents**

Expand All @@ -35,28 +35,19 @@ This module add five stars rating question type for survey page
Usage
=====

Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{200}/{10.0}

Known issues / Roadmap
======================
To use this module, you need to:

Bug Tracker
===========
#. Go to Surveys, create a new survey, add a question of type "Five Stars Rating"

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/survey/issues>`_. In case of trouble, please
.. image:: https://raw.githubusercontent.com/OCA/survey/survey_question_type_five_star/static/description/five_star_type.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/survey/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/survey/issues/new?body=module:%20survey_question_type_five_star%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/survey/issues/new?body=module:%20survey_question_type_five_star%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -73,6 +64,7 @@ Contributors

* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
* Olga Marco <olga.marco@creublanca.es>
* Benoit Aimont <benoit.aimont@acsone.eu>

Maintainers
~~~~~~~~~~~
Expand All @@ -87,6 +79,6 @@ 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 <https://github.com/OCA/survey/tree/14.0/survey_question_type_five_star>`_ project on GitHub.
This module is part of the `OCA/survey <https://github.com/OCA/survey/tree/16.0/survey_question_type_five_star>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 0 additions & 1 deletion survey_question_type_five_star/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import models
from . import tests
12 changes: 9 additions & 3 deletions survey_question_type_five_star/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
{
"name": "Survey five stars question type",
"summary": """
This module add five stars rating as question type for survey page""",
"version": "14.0.1.0.0",
This module adds five stars rating as question type for survey page""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/survey",
"depends": ["survey"],
"data": ["views/survey_question.xml", "templates/survey_template.xml"],
"demo": [],
"assets": {
"survey.survey_assets": [
"survey_question_type_five_star/static/src/js/survey.js",
"survey_question_type_five_star/static/src/scss/parameters.scss",
"survey_question_type_five_star/static/src/scss/survey.scss",
],
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ def save_lines(self, question, answer, comment=None):
if question.question_type in ["star_rate"]:
self._save_line_simple_answer(question, old_answers, answer)
else:
super(SurveyUserInput, self).save_lines(question, answer, comment=comment)
return super().save_lines(
question, answer, comment=comment
)

def _get_line_answer_values(self, question, answer, answer_type):
vals = super(SurveyUserInput, self)._get_line_answer_values(
vals = super()._get_line_answer_values(
question, answer, answer_type
)
if answer_type == "star_rate" and answer:
Expand Down
1 change: 1 addition & 0 deletions survey_question_type_five_star/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
* Olga Marco <olga.marco@creublanca.es>
* Benoit Aimont <benoit.aimont@acsone.eu>
2 changes: 1 addition & 1 deletion survey_question_type_five_star/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This module add five stars rating question type for survey page
This module adds five stars rating question type for survey page
Empty file.
Empty file.
Empty file.
5 changes: 0 additions & 5 deletions survey_question_type_five_star/readme/ROADMAP.rst

This file was deleted.

10 changes: 5 additions & 5 deletions survey_question_type_five_star/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{200}/{10.0}
To use this module, you need to:

#. Go to Surveys, create a new survey, add a question of type "Five Stars Rating"

.. image:: /OCA/survey/survey_question_type_five_star/static/description/five_star_type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 23 additions & 34 deletions survey_question_type_five_star/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Survey five stars question type</title>
<style type="text/css">

Expand Down Expand Up @@ -367,72 +367,61 @@ <h1 class="title">Survey five stars question type</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/survey/tree/14.0/survey_question_type_five_star"><img alt="OCA/survey" src="https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/survey-14-0/survey-14-0-survey_question_type_five_star"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/200/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module add five stars rating question type for survey page</p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/survey/tree/16.0/survey_question_type_five_star"><img alt="OCA/survey" src="https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/survey-16-0/survey-16-0-survey_question_type_five_star"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/survey&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds five stars rating question type for survey page</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id4">Usage</a></li>
<li><a class="reference internal" href="#id1" id="id5">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id6">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li>
<li><a class="reference internal" href="#id2" id="id8">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id9">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id10">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id11">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id12">Maintainers</a></li>
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id4">Usage</a></h1>
</div>
<div class="section" id="id1">
<h1><a class="toc-backref" href="#id5">Usage</a></h1>
<blockquote>
<a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/{200}/{10.0}"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a>
</blockquote>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id6">Known issues / Roadmap</a></h1>
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Go to Surveys, create a new survey, add a question of type “Five Stars Rating”</li>
</ol>
<img alt="https://raw.githubusercontent.com/OCA/survey/survey_question_type_five_star/static/description/five_star_type.png" src="https://raw.githubusercontent.com/OCA/survey/survey_question_type_five_star/static/description/five_star_type.png" />
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id7">Bug Tracker</a></h1>
<blockquote>
Bugs are tracked on <a class="reference external" href="https://github.com/OCA/survey/issues">GitHub Issues</a>. In case of trouble, please</blockquote>
</div>
<div class="section" id="id2">
<h1><a class="toc-backref" href="#id8">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/survey/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/survey/issues/new?body=module:%20survey_question_type_five_star%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/survey/issues/new?body=module:%20survey_question_type_five_star%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id9">Credits</a></h1>
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id10">Authors</a></h2>
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>ACSONE SA/NV</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id11">Contributors</a></h2>
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li>Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
<li>Olga Marco &lt;<a class="reference external" href="mailto:olga.marco&#64;creublanca.es">olga.marco&#64;creublanca.es</a>&gt;</li>
<li>Benoit Aimont &lt;<a class="reference external" href="mailto:benoit.aimont&#64;acsone.eu">benoit.aimont&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id12">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/survey/tree/14.0/survey_question_type_five_star">OCA/survey</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/survey/tree/16.0/survey_question_type_five_star">OCA/survey</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion survey_question_type_five_star/static/src/scss/survey.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
white-space: nowrap;
cursor: pointer;
font-size: 30px;
color: $nps-widget-color;
color: $star-widget-color;
}
31 changes: 6 additions & 25 deletions survey_question_type_five_star/templates/survey_template.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="assets_frontend"
inherit_id="survey.survey_assets"
name="Survey assets"
>
<xpath expr="//link[last()]" position="after">
<script
type="text/javascript"
src="/survey_question_type_five_star/static/src/js/survey.js"
/>
<link
href="/survey_question_type_five_star/static/src/scss/parameters.scss"
rel="stylesheet"
type="text/scss"
/>
<link
href="/survey_question_type_five_star/static/src/scss/survey.scss"
rel="stylesheet"
type="text/scss"
/>
</xpath>
</template>
<template id="question" inherit_id="survey.question_container">
<xpath expr="//t[@t-call='survey.question_text_box']/.." position="after">
<t t-if="question.question_type == 'star_rate'">
Expand All @@ -31,15 +9,18 @@
</template>
<template id="result" inherit_id="survey.survey_page_statistics_question">
<xpath
expr="//t[@t-call='survey.question_result_number_or_date']/parent::t"
expr="//t[@t-call='survey.question_result_number_or_date_or_datetime']"
position="after"
>
<t t-if="question.question_type == 'star_rate'">
<t t-call="survey.question_result_number_or_date" />
<t t-call="survey.question_result_number_or_date_or_datetime" />
</t>
</xpath>
</template>
<template id="result_user" inherit_id="survey.question_result_number_or_date">
<template
id="result_user"
inherit_id="survey.question_result_number_or_date_or_datetime"
>
<xpath expr="//a[@t-field='input_line.value_date']" position="after">
<a
t-if="question.question_type == 'star_rate'"
Expand Down
4 changes: 2 additions & 2 deletions survey_question_type_five_star/tests/test_survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

class TestSurvey(common.SurveyCase):
def setUp(self):
super(TestSurvey, self).setUp()
User = self.env["res.users"].with_context({"no_reset_password": True})
super().setUp()
User = self.env["res.users"].with_context(no_reset_password=True)
(group_survey_user, group_employee) = (
self.ref("survey.group_survey_user"),
self.ref("base.group_user"),
Expand Down

0 comments on commit cf1602c

Please sign in to comment.