diff --git a/setup/survey_sale/odoo/addons/survey_sale b/setup/survey_sale/odoo/addons/survey_sale new file mode 120000 index 00000000..dc035afe --- /dev/null +++ b/setup/survey_sale/odoo/addons/survey_sale @@ -0,0 +1 @@ +../../../../survey_sale \ No newline at end of file diff --git a/setup/survey_sale/setup.py b/setup/survey_sale/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/survey_sale/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/survey_sale/README.rst b/survey_sale/README.rst new file mode 100644 index 00000000..8baa040c --- /dev/null +++ b/survey_sale/README.rst @@ -0,0 +1,86 @@ +=========== +Survey Sale +=========== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e990148f488831cfa1259013f8a7adb0d48cb5f5a1acdf75fcd8b471580ea9b3 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/survey_sale + :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_sale + :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 addon allows to create surveys from sale orders + +**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 +~~~~~~~ + +* Binhex + +Contributors +~~~~~~~~~~~~ + +* `Binhex `_: + + * Adasat Torres de León + +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-adasatorres| image:: https://github.com/adasatorres.png?size=40px + :target: https://github.com/adasatorres + :alt: adasatorres + +Current `maintainer `__: + +|maintainer-adasatorres| + +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_sale/__init__.py b/survey_sale/__init__.py new file mode 100644 index 00000000..e6ac9c6e --- /dev/null +++ b/survey_sale/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import models diff --git a/survey_sale/__manifest__.py b/survey_sale/__manifest__.py new file mode 100644 index 00000000..57b2795c --- /dev/null +++ b/survey_sale/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Survey Sale", + "summary": """ + This addon allows to create surveys from sale orders""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Binhex, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/survey", + "depends": ["survey_link_base", "sale_management"], + "data": [ + "views/res_config_settings_views.xml", + "views/sale_order_views.xml", + ], + "maintainers": ["adasatorres"], +} diff --git a/survey_sale/i18n/es.po b/survey_sale/i18n/es.po new file mode 100644 index 00000000..17d87bf3 --- /dev/null +++ b/survey_sale/i18n/es.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * survey_sale +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0-20240104\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-12-31 08:28+0000\n" +"PO-Revision-Date: 2024-12-31 08:32+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.5\n" + +#. module: survey_sale +#: model:ir.model,name:survey_sale.model_res_company +msgid "Companies" +msgstr "Empresas" + +#. module: survey_sale +#: model:ir.model,name:survey_sale.model_res_config_settings +msgid "Config Settings" +msgstr "Configuración" + +#. module: survey_sale +#: model:ir.model.fields,field_description:survey_sale.field_res_company__survey_sale_id +msgid "Default Sale Survey" +msgstr "Encuesta de Venta Predeterminada" + +#. module: survey_sale +#: model:ir.model.fields,field_description:survey_sale.field_res_config_settings__survey_sale_id +msgid "Default sale Survey" +msgstr "Encuesta de venta predeterminada" + +#. module: survey_sale +#: model_terms:ir.ui.view,arch_db:survey_sale.res_config_settings_form_inherit +msgid "Sale Survey" +msgstr "Encuesta de Venta" + +#. module: survey_sale +#: model:ir.model,name:survey_sale.model_sale_order +msgid "Sales Order" +msgstr "Orden de Venta" + +#. module: survey_sale +#: model_terms:ir.ui.view,arch_db:survey_sale.sale_order_form_inherit +msgid "Start Survey" +msgstr "Iniciar Encuesta" + +#. module: survey_sale +#: model_terms:ir.ui.view,arch_db:survey_sale.sale_order_form_inherit +msgid "Survey" +msgstr "Encuesta" + +#. module: survey_sale +#: model:ir.model.fields,field_description:survey_sale.field_sale_order__survey_count +msgid "Survey Count" +msgstr "Conteo de Encuestas" diff --git a/survey_sale/i18n/survey_sale.pot b/survey_sale/i18n/survey_sale.pot new file mode 100644 index 00000000..e4d7ba93 --- /dev/null +++ b/survey_sale/i18n/survey_sale.pot @@ -0,0 +1,61 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * survey_sale +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0-20240104\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-12-31 08:28+0000\n" +"PO-Revision-Date: 2024-12-31 08:28+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_sale +#: model:ir.model,name:survey_sale.model_res_company +msgid "Companies" +msgstr "" + +#. module: survey_sale +#: model:ir.model,name:survey_sale.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: survey_sale +#: model:ir.model.fields,field_description:survey_sale.field_res_company__survey_sale_id +msgid "Default Sale Survey" +msgstr "" + +#. module: survey_sale +#: model:ir.model.fields,field_description:survey_sale.field_res_config_settings__survey_sale_id +msgid "Default sale Survey" +msgstr "" + +#. module: survey_sale +#: model_terms:ir.ui.view,arch_db:survey_sale.res_config_settings_form_inherit +msgid "Sale Survey" +msgstr "" + +#. module: survey_sale +#: model:ir.model,name:survey_sale.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: survey_sale +#: model_terms:ir.ui.view,arch_db:survey_sale.sale_order_form_inherit +msgid "Start Survey" +msgstr "" + +#. module: survey_sale +#: model_terms:ir.ui.view,arch_db:survey_sale.sale_order_form_inherit +msgid "Survey" +msgstr "" + +#. module: survey_sale +#: model:ir.model.fields,field_description:survey_sale.field_sale_order__survey_count +msgid "Survey Count" +msgstr "" diff --git a/survey_sale/models/__init__.py b/survey_sale/models/__init__.py new file mode 100644 index 00000000..0822af38 --- /dev/null +++ b/survey_sale/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import res_company +from . import res_config_settings +from . import sale_order diff --git a/survey_sale/models/res_company.py b/survey_sale/models/res_company.py new file mode 100644 index 00000000..6491646c --- /dev/null +++ b/survey_sale/models/res_company.py @@ -0,0 +1,11 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + survey_sale_id = fields.Many2one( + comodel_name="survey.survey", string="Default Sale Survey" + ) diff --git a/survey_sale/models/res_config_settings.py b/survey_sale/models/res_config_settings.py new file mode 100644 index 00000000..5591b14c --- /dev/null +++ b/survey_sale/models/res_config_settings.py @@ -0,0 +1,14 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + survey_sale_id = fields.Many2one( + comodel_name="survey.survey", + string="Default sale Survey", + related="company_id.survey_sale_id", + readonly=False, + ) diff --git a/survey_sale/models/sale_order.py b/survey_sale/models/sale_order.py new file mode 100644 index 00000000..d3c31835 --- /dev/null +++ b/survey_sale/models/sale_order.py @@ -0,0 +1,16 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import models + + +class SaleOrder(models.Model): + _name = "sale.order" + _inherit = ["sale.order", "survey.link.mixin"] + + def get_default_survey(self): + res = super().get_default_survey() + if self.env.company.survey_sale_id: + return self.env.company.survey_sale_id.id + return res diff --git a/survey_sale/readme/CONTRIBUTORS.rst b/survey_sale/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..a2a3a6b6 --- /dev/null +++ b/survey_sale/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Binhex `_: + + * Adasat Torres de León diff --git a/survey_sale/readme/DESCRIPTION.rst b/survey_sale/readme/DESCRIPTION.rst new file mode 100644 index 00000000..59b4a1b5 --- /dev/null +++ b/survey_sale/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This addon allows to create surveys from sale orders diff --git a/survey_sale/static/description/icon.png b/survey_sale/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/survey_sale/static/description/icon.png differ diff --git a/survey_sale/static/description/index.html b/survey_sale/static/description/index.html new file mode 100644 index 00000000..8eee324e --- /dev/null +++ b/survey_sale/static/description/index.html @@ -0,0 +1,425 @@ + + + + + +Survey Sale + + + +
+

Survey Sale

+ + +

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

+

This addon allows to create surveys from sale orders

+

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

+
    +
  • Binhex
  • +
+
+
+

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:

+

adasatorres

+

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_sale/tests/__init__.py b/survey_sale/tests/__init__.py new file mode 100644 index 00000000..ea974520 --- /dev/null +++ b/survey_sale/tests/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from . import test_survey_sale diff --git a/survey_sale/tests/test_survey_sale.py b/survey_sale/tests/test_survey_sale.py new file mode 100644 index 00000000..20054af4 --- /dev/null +++ b/survey_sale/tests/test_survey_sale.py @@ -0,0 +1,29 @@ +# Copyright 2024 Binhex - Adasat Torres de León +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import tagged +from odoo.tests.common import TransactionCase + + +@tagged("post_install", "-at_install") +class TestSurveySale(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.survey = cls.env["survey.survey"].create({"title": "Survey Test"}) + cls.partner_id = cls.env["res.partner"].create( + {"name": "Test Partner", "email": "test@test.com"} + ) + cls.company = cls.env.company + cls.sale = cls.env["sale.order"].create( + { + "name": "Test Sale", + "company_id": cls.company.id, + "partner_id": cls.partner_id.id, + } + ) + + def test_get_default_survey(self): + self.company.survey_sale_id = False + self.assertFalse(self.sale.get_default_survey()) + self.company.survey_sale_id = self.survey.id + self.assertEqual(self.sale.get_default_survey(), self.survey.id) diff --git a/survey_sale/views/res_config_settings_views.xml b/survey_sale/views/res_config_settings_views.xml new file mode 100644 index 00000000..1de00069 --- /dev/null +++ b/survey_sale/views/res_config_settings_views.xml @@ -0,0 +1,35 @@ + + + + res.config.settings.form.inherit + res.config.settings + + + +

Sale Survey

+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/survey_sale/views/sale_order_views.xml b/survey_sale/views/sale_order_views.xml new file mode 100644 index 00000000..93e3d730 --- /dev/null +++ b/survey_sale/views/sale_order_views.xml @@ -0,0 +1,29 @@ + + + + sale.order.form.inherit + sale.order + + + + + + + + diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..983bb11b --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-survey_link_base @ git+https://github.com/OCA/survey.git@refs/pull/141/head#subdirectory=setup/survey_link_base