diff --git a/base_crm_project/README.rst b/base_crm_project/README.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/base_crm_project/__init__.py b/base_crm_project/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/base_crm_project/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/base_crm_project/__manifest__.py b/base_crm_project/__manifest__.py new file mode 100644 index 00000000000..0c4ed2bbd30 --- /dev/null +++ b/base_crm_project/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +{ + "name": "Base CRM Project", + "summary": "Link between Crm and Task", + "version": "15.0.1.0.0", + "development_status": "Alpha", + "category": "Sales/CRM", + "website": "https://github.com/OCA/crm", + "author": "Moduon, Odoo Community Association (OCA)", + "maintainers": ["EmilioPascual"], + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "crm", + "project", + ], + "data": [ + "views/crm_lead.xml", + "views/project_task.xml", + ], +} diff --git a/base_crm_project/i18n/base_crm_project.pot b/base_crm_project/i18n/base_crm_project.pot new file mode 100644 index 00000000000..6cf9d3379c8 --- /dev/null +++ b/base_crm_project/i18n/base_crm_project.pot @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_crm_project +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-07-27 13:28+0000\n" +"PO-Revision-Date: 2023-07-27 13: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: base_crm_project +#: model:ir.model.fields,field_description:base_crm_project.field_crm_lead__task_count +msgid "#Task" +msgstr "" + +#. module: base_crm_project +#: model:ir.model.fields,field_description:base_crm_project.field_project_task__lead_id +msgid "Lead" +msgstr "" + +#. module: base_crm_project +#: model:ir.model,name:base_crm_project.model_crm_lead +#: model_terms:ir.ui.view,arch_db:base_crm_project.view_task_form2_inherit_base_crm_project +msgid "Lead/Opportunity" +msgstr "" + +#. module: base_crm_project +#: model:ir.model,name:base_crm_project.model_project_task +#: model:ir.model.fields,field_description:base_crm_project.field_crm_lead__task_ids +msgid "Task" +msgstr "" + +#. module: base_crm_project +#: model_terms:ir.ui.view,arch_db:base_crm_project.inherit_crm_lead_view_form_base_crm_project +msgid "Task(s)" +msgstr "" diff --git a/base_crm_project/i18n/es.po b/base_crm_project/i18n/es.po new file mode 100644 index 00000000000..777f21cce7e --- /dev/null +++ b/base_crm_project/i18n/es.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_crm_project +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-07-27 13:28+0000\n" +"PO-Revision-Date: 2023-07-27 15:30+0200\n" +"Last-Translator: Emilio Pascual \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: \n" +"X-Generator: Poedit 3.3.1\n" + +#. module: base_crm_project +#: model:ir.model.fields,field_description:base_crm_project.field_crm_lead__task_count +msgid "#Task" +msgstr "#Task" + +#. module: base_crm_project +#: model:ir.model.fields,field_description:base_crm_project.field_project_task__lead_id +msgid "Lead" +msgstr "Iniciativa/Oportunidad" + +#. module: base_crm_project +#: model:ir.model,name:base_crm_project.model_crm_lead +#: model_terms:ir.ui.view,arch_db:base_crm_project.view_task_form2_inherit_base_crm_project +msgid "Lead/Opportunity" +msgstr "Iniciativa/Oportunidad" + +#. module: base_crm_project +#: model:ir.model,name:base_crm_project.model_project_task +#: model:ir.model.fields,field_description:base_crm_project.field_crm_lead__task_ids +msgid "Task" +msgstr "Tarea" + +#. module: base_crm_project +#: model_terms:ir.ui.view,arch_db:base_crm_project.inherit_crm_lead_view_form_base_crm_project +msgid "Task(s)" +msgstr "Tareas" diff --git a/base_crm_project/models/__init__.py b/base_crm_project/models/__init__.py new file mode 100644 index 00000000000..4e988ea8b4d --- /dev/null +++ b/base_crm_project/models/__init__.py @@ -0,0 +1,2 @@ +from . import project_task +from . import crm_lead diff --git a/base_crm_project/models/crm_lead.py b/base_crm_project/models/crm_lead.py new file mode 100644 index 00000000000..e78fe6da28d --- /dev/null +++ b/base_crm_project/models/crm_lead.py @@ -0,0 +1,24 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from odoo import api, fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + task_ids = fields.One2many("project.task", "lead_id") + task_count = fields.Integer("#Task", compute="_compute_task_count") + + @api.depends("task_ids") + def _compute_task_count(self): + for lead in self: + lead.task_count = len(lead.task_ids) + + def action_tasks(self): + self.ensure_one() + ctx = self._context.copy() + action = self.env.ref("project.action_view_task").sudo().read()[0] + ctx.update({"default_lead_id": self.id}) + action.update({"context": ctx, "domain": [("lead_id", "=", self.id)]}) + return action diff --git a/base_crm_project/models/project_task.py b/base_crm_project/models/project_task.py new file mode 100644 index 00000000000..e7636ee0c28 --- /dev/null +++ b/base_crm_project/models/project_task.py @@ -0,0 +1,10 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from odoo import fields, models + + +class CrmLead(models.Model): + _inherit = "project.task" + + lead_id = fields.Many2one("crm.lead") diff --git a/base_crm_project/readme/CONTRIBUTORS.rst b/base_crm_project/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..281e09d04ce --- /dev/null +++ b/base_crm_project/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Emilio Pascual (`Moduon `__) +* Rafael Blasco (`Moduon `__) diff --git a/base_crm_project/readme/DESCRIPTION.rst b/base_crm_project/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..8fb77f6ce60 --- /dev/null +++ b/base_crm_project/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module added link between lead/oportunity and tasks diff --git a/base_crm_project/static/description/icon.png b/base_crm_project/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/base_crm_project/static/description/icon.png differ diff --git a/base_crm_project/static/description/index.html b/base_crm_project/static/description/index.html new file mode 100644 index 00000000000..839cec049eb --- /dev/null +++ b/base_crm_project/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + +CRM Project Task + + + +
+

CRM Project Task

+ + +

Alpha License: AGPL-3 OCA/crm Translate me on Weblate Try me on Runbot

+

This module allow create task from leads/opportunities

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  • Go to Project
  • +
  • Create a project with right configuration in order that all salesman have access (usually all employees)
  • +
  • Go to CRM > Configuration > Project
  • +
  • Set crm default project
  • +
+
+
+

Usage

+
    +
  1. Go to CRM > Sales > My pipeline.
  2. +
  3. Open one of the existing leads or create one.
  4. +
  5. Click on the button “Create Task”.
  6. +
  7. A popup will appear asking you name and description for create task.
  8. +
  9. Click on “Create Task” button.
  10. +
  11. A task will be created with project in settings.
  12. +
  13. A message chatter will be created in task with link for lead/opportunity. Also, a message chatter will be creat in lead/opportunity with link for task.
  14. +
+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Moduon
  • +
+
+
+

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:

+

EmilioPascual

+

This module is part of the OCA/crm project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/base_crm_project/tests/__init__.py b/base_crm_project/tests/__init__.py new file mode 100644 index 00000000000..a3fde5054b8 --- /dev/null +++ b/base_crm_project/tests/__init__.py @@ -0,0 +1 @@ +from . import test_base_crm_project diff --git a/base_crm_project/tests/test_base_crm_project.py b/base_crm_project/tests/test_base_crm_project.py new file mode 100644 index 00000000000..715172930ba --- /dev/null +++ b/base_crm_project/tests/test_base_crm_project.py @@ -0,0 +1,50 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from odoo.tests import tagged +from odoo.tests.common import TransactionCase + +from odoo.addons.mail.tests.common import mail_new_test_user + + +@tagged("post_install", "-at_install") +class TestBaseCrmProject(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.company = cls.env.user.company_id + cls.user_salesman = mail_new_test_user( + cls.env, + login="user_test", + name="User Test", + email="user_test@test.example.com", + company_id=cls.company.id, + groups="sales_team.group_sale_salesman", + ) + cls.partner = cls.env["res.partner"].create( + { + "name": "Partner Test", + } + ) + cls.lead = cls.env["crm.lead"].create( + { + "name": "Test Lead", + "type": "lead", + "partner_id": cls.partner.id, + "user_id": cls.user_salesman.id, + } + ) + cls.project = cls.env["project.project"].create( + { + "name": "Test Project", + } + ) + cls.task = cls.env["project.task"].create( + {"name": "Test Name", "lead_id": cls.lead.id} + ) + + def test_action_tasks(self): + action = self.lead.action_tasks() + tasks = self.env["project.task"].search(action["domain"]) + tasks_lead = tasks.mapped("lead_id") + self.assertEqual(self.lead, tasks_lead) diff --git a/base_crm_project/views/crm_lead.xml b/base_crm_project/views/crm_lead.xml new file mode 100644 index 00000000000..cedc5e36ce1 --- /dev/null +++ b/base_crm_project/views/crm_lead.xml @@ -0,0 +1,23 @@ + + + + + crm.lead.view.form.inherit.base.crm.project + crm.lead + + + + + + + + + diff --git a/base_crm_project/views/project_task.xml b/base_crm_project/views/project_task.xml new file mode 100644 index 00000000000..2c1049bc572 --- /dev/null +++ b/base_crm_project/views/project_task.xml @@ -0,0 +1,17 @@ + + + + + project.task.form.inherit.base.crm.project + project.task + + + + + + + + + + diff --git a/setup/base_crm_project/odoo/addons/base_crm_project b/setup/base_crm_project/odoo/addons/base_crm_project new file mode 120000 index 00000000000..3c07f416f2d --- /dev/null +++ b/setup/base_crm_project/odoo/addons/base_crm_project @@ -0,0 +1 @@ +../../../../base_crm_project \ No newline at end of file diff --git a/setup/base_crm_project/setup.py b/setup/base_crm_project/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/base_crm_project/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)