@ -0,0 +1,51 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Question Duplicator In Survey |
|||
============================= |
|||
In this module, we add an option for the duplicate the questions in the survey. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V16) yadhukrishnan @ cybrosys, |
|||
(V17) Safa Faheem PE @cybrosys, |
|||
(V18) Ammu Raj @cybrosys, |
|||
Contact: odoo@cybrosys.comodoo |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
|||
|
|||
|
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
################################################################################ |
|||
from . import models |
|||
from . import wizards |
@ -0,0 +1,43 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
################################################################################ |
|||
{ |
|||
'name': 'Question Duplicator In Survey', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Marketing', |
|||
'summary': """Option for duplicating survey questions.""", |
|||
'description': "In this module, users can get an option for duplicating" |
|||
"questions for differnt survey.", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['survey'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/action_question_duplicate.xml', |
|||
'wizards/question_duplicate_views.xml' |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <survey_question_duplicator> |
|||
|
|||
#### 02.12.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial Commit for Question Duplicator In Survey |
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
################################################################################ |
|||
from . import survey_question |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
################################################################################ |
|||
from odoo import models |
|||
|
|||
|
|||
class SurveyQuestion(models.Model): |
|||
"""To write function for survey question buttons """ |
|||
_inherit = 'survey.question' |
|||
|
|||
def action_add_question(self): |
|||
"""Summary: |
|||
Function to view question wizard |
|||
Returns: |
|||
returns the view of the 'question.wizard' view. """ |
|||
return { |
|||
'name': "Add To Survey", |
|||
'view_mode': 'form', |
|||
'res_model': 'question.duplicate', |
|||
'type': 'ir.actions.act_window', |
|||
'target': 'new', |
|||
} |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 9.9 KiB |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- action for add to survey wizard--> |
|||
<record id="action_question_question" model="ir.actions.server"> |
|||
<field name="name">Add To Survey</field> |
|||
<field name="model_id" ref="survey.model_survey_question"/> |
|||
<field name="binding_model_id" ref="survey.model_survey_question"/> |
|||
<field name="binding_view_types">list,form</field> |
|||
<field name="state">code</field> |
|||
<field name="code">action =records.action_add_question() |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
################################################################################ |
|||
from . import question_duplicate |
@ -0,0 +1,93 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
################################################################################ |
|||
from odoo import fields, models, _ |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class QuestionDuplicate(models.TransientModel): |
|||
""" The ActionWizard class is creating questions for the selected surveys. |
|||
Methods: |
|||
action_add_survey(self): |
|||
creating new records for the selected surveys |
|||
while clicking "action_add_survey" button. """ |
|||
_name = "question.duplicate" |
|||
_description = "Question Duplicate" |
|||
|
|||
survey_ids = fields.Many2many('survey.survey', string="Surveys", |
|||
help="Select the survey to duplicate the" |
|||
" question") |
|||
|
|||
def action_check_survey(self): |
|||
""" Summary: |
|||
Checking the surveys selected showing exception or creating record |
|||
by calling the "creating_questions" method while clicking |
|||
"action_add_survey" button. """ |
|||
if self.survey_ids: |
|||
flag = 0 |
|||
for question_id in self._context.get('active_ids'): |
|||
for survey_id in self.survey_ids: |
|||
question = self.env['survey.question'].browse(question_id) |
|||
selected_question = self.env['survey.question'].search( |
|||
[('survey_id', '=', survey_id.id), ('title', '=', question.title)]) |
|||
if selected_question: |
|||
flag = 1 |
|||
if flag == 1: |
|||
raise ValidationError( |
|||
_("The selected question is already included in the" |
|||
" survey.")) |
|||
else: |
|||
self.create_question() |
|||
else: |
|||
raise ValidationError(_("Please Select The Surveys")) |
|||
|
|||
def create_question(self): |
|||
""" Summary: |
|||
creating new records for the selected surveys while calling in the |
|||
"action_add_survey" method. """ |
|||
for question_id in self._context.get('active_ids'): |
|||
survey_question_id = self.env['survey.question'].browse(question_id) |
|||
for survey_id in self.survey_ids: |
|||
question_vals = { |
|||
'survey_id': survey_id.id, |
|||
'title': survey_question_id.title, |
|||
'question_type': survey_question_id.question_type, |
|||
'description': survey_question_id.description, |
|||
'comments_allowed': survey_question_id.comments_allowed, |
|||
'constr_mandatory': survey_question_id.constr_mandatory, |
|||
'constr_error_msg': survey_question_id.constr_error_msg, |
|||
'triggering_answer_ids': survey_question_id.triggering_answer_ids, |
|||
'is_time_limited': survey_question_id.is_time_limited, |
|||
'question_placeholder': survey_question_id.question_placeholder, |
|||
'validation_required': survey_question_id.validation_required, |
|||
'matrix_subtype': survey_question_id.matrix_subtype, |
|||
} |
|||
question = self.env['survey.question'].sudo().create( |
|||
question_vals) |
|||
answer_ids = survey_question_id.suggested_answer_ids.filtered( |
|||
lambda r: r.value) |
|||
answer_vals = answer_ids.mapped(lambda r: { |
|||
'question_id': question.id, |
|||
'value': r.value, |
|||
'is_correct': r.is_correct, |
|||
'answer_score': r.answer_score, |
|||
'value_image': r.value_image, |
|||
}) |
|||
self.env['survey.question.answer'].sudo().create(answer_vals) |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- form view for the question duplicate wizard--> |
|||
<record id="question_duplicate_view_form" model="ir.ui.view"> |
|||
<field name="name">question.duplicate.view.form</field> |
|||
<field name="model">question.duplicate</field> |
|||
<field name="arch" type="xml"> |
|||
<form name="question"> |
|||
<group> |
|||
<field name="survey_ids" widget="many2many_tags"/> |
|||
</group> |
|||
<footer> |
|||
<button class="btn-secondary" string="Cancel" |
|||
special="cancel"/> |
|||
<button name="action_check_survey" type="object" |
|||
class="btn btn-primary change_stage_action">Add To |
|||
Survey |
|||
</button> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
</odoo> |