From 444e3a382896ea8359f19683199780a615dfe111 Mon Sep 17 00:00:00 2001 From: eduezerouali-tecnativa Date: Tue, 16 Dec 2025 12:41:38 +0100 Subject: [PATCH 1/2] [ADD] survey_crm_generation_model_selection: new module --- .../README.rst | 87 ++++ .../__init__.py | 1 + .../__manifest__.py | 14 + .../models/__init__.py | 2 + .../models/survey_question.py | 20 + .../models/survey_user_input.py | 17 + .../pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 2 + .../readme/DESCRIPTION.md | 1 + .../static/description/index.html | 429 ++++++++++++++++++ 10 files changed, 576 insertions(+) create mode 100644 survey_crm_generation_model_selection/README.rst create mode 100644 survey_crm_generation_model_selection/__init__.py create mode 100644 survey_crm_generation_model_selection/__manifest__.py create mode 100644 survey_crm_generation_model_selection/models/__init__.py create mode 100644 survey_crm_generation_model_selection/models/survey_question.py create mode 100644 survey_crm_generation_model_selection/models/survey_user_input.py create mode 100644 survey_crm_generation_model_selection/pyproject.toml create mode 100644 survey_crm_generation_model_selection/readme/CONTRIBUTORS.md create mode 100644 survey_crm_generation_model_selection/readme/DESCRIPTION.md create mode 100644 survey_crm_generation_model_selection/static/description/index.html diff --git a/survey_crm_generation_model_selection/README.rst b/survey_crm_generation_model_selection/README.rst new file mode 100644 index 00000000..58af8412 --- /dev/null +++ b/survey_crm_generation_model_selection/README.rst @@ -0,0 +1,87 @@ +========================================= +Survey CRM generation for model selection +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1ed70ed2baad9fdb72626d6449dca767166a726a4ab008b85ce8c5959be52662 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/licence-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/17.0/survey_crm_generation_model_selection + :alt: OCA/survey +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/survey-17-0/survey-17-0-survey_crm_generation_model_selection + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to generate new lead from surveys answers from +question type model selection. + +**Table of contents** + +.. contents:: + :local: + +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 +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__ + + - Eduardo Ezerouali + +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. + +.. |maintainer-eduezerouali-tecnativa| image:: https://github.com/eduezerouali-tecnativa.png?size=40px + :target: https://github.com/eduezerouali-tecnativa + :alt: eduezerouali-tecnativa + +Current `maintainer `__: + +|maintainer-eduezerouali-tecnativa| + +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_crm_generation_model_selection/__init__.py b/survey_crm_generation_model_selection/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/survey_crm_generation_model_selection/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/survey_crm_generation_model_selection/__manifest__.py b/survey_crm_generation_model_selection/__manifest__.py new file mode 100644 index 00000000..bdff78ad --- /dev/null +++ b/survey_crm_generation_model_selection/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2025 Tecnativa - Eduardo Ezerouali +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Survey CRM generation for model selection", + "summary": "Generate new leads from surveys using model selection", + "version": "17.0.1.0.0", + "category": "Marketing/Survey", + "website": "https://github.com/OCA/survey", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["eduezerouali-tecnativa"], + "license": "AGPL-3", + "depends": ["survey_crm_generation", "survey_question_type_model_selection"], + "auto_install": True, +} diff --git a/survey_crm_generation_model_selection/models/__init__.py b/survey_crm_generation_model_selection/models/__init__.py new file mode 100644 index 00000000..b5635ae6 --- /dev/null +++ b/survey_crm_generation_model_selection/models/__init__.py @@ -0,0 +1,2 @@ +from . import survey_question +from . import survey_user_input diff --git a/survey_crm_generation_model_selection/models/survey_question.py b/survey_crm_generation_model_selection/models/survey_question.py new file mode 100644 index 00000000..a17327e4 --- /dev/null +++ b/survey_crm_generation_model_selection/models/survey_question.py @@ -0,0 +1,20 @@ +# Copyright 2025 Tecnativa - Eduardo Ezerouali +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, models + + +class SurveyQuestion(models.Model): + _inherit = "survey.question" + + @api.depends("question_type") + def _compute_allowed_crm_lead_field_domain(self): + res = super()._compute_allowed_crm_lead_field_domain() + for record in self: + if record.question_type == "model": + record.allowed_partner_field_domain = [ + ("model", "=", "crm.lead"), + ("ttype", "in", ["many2one", "many2many"]), + ("store", "=", True), + ("readonly", "=", False), + ] + return res diff --git a/survey_crm_generation_model_selection/models/survey_user_input.py b/survey_crm_generation_model_selection/models/survey_user_input.py new file mode 100644 index 00000000..5482b2f8 --- /dev/null +++ b/survey_crm_generation_model_selection/models/survey_user_input.py @@ -0,0 +1,17 @@ +# Copyright 2025 Tecnativa - Eduardo Ezerouali +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import models + + +class SurveyUserInput(models.Model): + _inherit = "survey.user_input" + + def _prepare_opportunity(self): + res = super()._prepare_opportunity() + for key, value in res.items(): + if isinstance(value, models.BaseModel): + if len(value) == 1: + res[key] = value.id + else: + res[key] = [(6, 0, value.ids)] + return res diff --git a/survey_crm_generation_model_selection/pyproject.toml b/survey_crm_generation_model_selection/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/survey_crm_generation_model_selection/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/survey_crm_generation_model_selection/readme/CONTRIBUTORS.md b/survey_crm_generation_model_selection/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..4462ed21 --- /dev/null +++ b/survey_crm_generation_model_selection/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Tecnativa](https://www.tecnativa.com) + - Eduardo Ezerouali diff --git a/survey_crm_generation_model_selection/readme/DESCRIPTION.md b/survey_crm_generation_model_selection/readme/DESCRIPTION.md new file mode 100644 index 00000000..351e3f15 --- /dev/null +++ b/survey_crm_generation_model_selection/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to generate new lead from surveys answers from question type model selection. diff --git a/survey_crm_generation_model_selection/static/description/index.html b/survey_crm_generation_model_selection/static/description/index.html new file mode 100644 index 00000000..274f7b37 --- /dev/null +++ b/survey_crm_generation_model_selection/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +Survey CRM generation for model selection + + + +
+

Survey CRM generation for model selection

+ + +

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

+

This module allows to generate new lead from surveys answers from +question type model selection.

+

Table of contents

+ +
+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

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.

+

Current maintainer:

+

eduezerouali-tecnativa

+

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.

+
+
+
+ + From acac603c32a3ded0a685f244b474a01a4eeba957 Mon Sep 17 00:00:00 2001 From: eduezerouali-tecnativa Date: Tue, 16 Dec 2025 12:56:27 +0100 Subject: [PATCH 2/2] [DON'T MERGE] test-requirements.txt --- test-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test-requirements.txt b/test-requirements.txt index 66bc2cba..e515c6a6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1,2 @@ odoo_test_helper +odoo-addon-survey_question_type_model_selection @ git+https://github.com/OCA/survey.git@refs/pull/209/head#subdirectory=survey_question_type_model_selection