diff --git a/crm_won_reason/README.rst b/crm_won_reason/README.rst new file mode 100644 index 00000000000..5a45390da34 --- /dev/null +++ b/crm_won_reason/README.rst @@ -0,0 +1,85 @@ +============== +CRM won reason +============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:dee9800d76ab558e0940d25d9a45a47a4dc933e68c11aa4e8d60d4c8379691ed + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fcrm-lightgray.png?logo=github + :target: https://github.com/OCA/crm/tree/18.0/crm_won_reason + :alt: OCA/crm +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_won_reason + :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/crm&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds possibility to define lost & won reasons to be applied +on leads. + +**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 +------- + +* Camptocamp + +Contributors +------------ + +- Anna Janiszewska + +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-ajaniszewska-dev| image:: https://github.com/ajaniszewska-dev.png?size=40px + :target: https://github.com/ajaniszewska-dev + :alt: ajaniszewska-dev + +Current `maintainer `__: + +|maintainer-ajaniszewska-dev| + +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/crm_won_reason/__init__.py b/crm_won_reason/__init__.py new file mode 100644 index 00000000000..9b4296142f4 --- /dev/null +++ b/crm_won_reason/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizard diff --git a/crm_won_reason/__manifest__.py b/crm_won_reason/__manifest__.py new file mode 100644 index 00000000000..7913e442f4e --- /dev/null +++ b/crm_won_reason/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +{ + "name": "CRM won reason", + "version": "18.0.1.0.0", + "category": "Customer Relationship Management", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/crm", + "license": "AGPL-3", + "depends": ["crm"], + "data": [ + "security/ir.model.access.csv", + "wizard/crm_lead_won.xml", + "views/crm_views.xml", + ], + "installable": True, + "maintainers": ["ajaniszewska-dev"], +} diff --git a/crm_won_reason/i18n/crm_won_reason.pot b/crm_won_reason/i18n/crm_won_reason.pot new file mode 100644 index 00000000000..017ca3b7214 --- /dev/null +++ b/crm_won_reason/i18n/crm_won_reason.pot @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_won_reason +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \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: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Cancel" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__create_uid +msgid "Created by" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__create_date +msgid "Created on" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__display_name +msgid "Display Name" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead_lost +msgid "Get Lost Reason" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead_won +msgid "Get Won Reason" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__id +msgid "ID" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won____last_update +msgid "Last Modified on" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__write_date +msgid "Last Updated on" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields.selection,name:crm_won_reason.selection__crm_lost_reason__reason_type__lost +msgid "Lost" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_lost__lost_reason_id +msgid "Lost Reason" +msgstr "" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_view_form +msgid "Mark as won" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lost_reason +msgid "Opp. Lost Reason" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lost_reason__reason_type +msgid "Reason Type" +msgstr "" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Submit" +msgstr "" + +#. module: crm_won_reason +#: model:ir.actions.act_window,name:crm_won_reason.crm_lead_win_action +msgid "Win Reason" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields.selection,name:crm_won_reason.selection__crm_lost_reason__reason_type__won +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_view_form +msgid "Won" +msgstr "" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead__won_reason_id +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__won_reason_id +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Won Reason" +msgstr "" diff --git a/crm_won_reason/i18n/es.po b/crm_won_reason/i18n/es.po new file mode 100644 index 00000000000..284c0366f6c --- /dev/null +++ b/crm_won_reason/i18n/es.po @@ -0,0 +1,120 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_won_reason +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-09-26 14:18+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Cancel" +msgstr "Cancelar" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead_lost +msgid "Get Lost Reason" +msgstr "Razón de la pérdida" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead_won +msgid "Get Won Reason" +msgstr "Obtener Razón de la Ganancia" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__id +msgid "ID" +msgstr "ID" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciativa/Oportunidad" + +#. module: crm_won_reason +#: model:ir.model.fields.selection,name:crm_won_reason.selection__crm_lost_reason__reason_type__lost +msgid "Lost" +msgstr "Perdida" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_lost__lost_reason_id +msgid "Lost Reason" +msgstr "Razón de pérdida" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_view_form +msgid "Mark as won" +msgstr "Marcar como ganada" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lost_reason +msgid "Opp. Lost Reason" +msgstr "Opp. Razón Perdida" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lost_reason__reason_type +msgid "Reason Type" +msgstr "Tipo de motivo" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Submit" +msgstr "Enviar" + +#. module: crm_won_reason +#: model:ir.actions.act_window,name:crm_won_reason.crm_lead_win_action +msgid "Win Reason" +msgstr "Razón de ganar" + +#. module: crm_won_reason +#: model:ir.model.fields.selection,name:crm_won_reason.selection__crm_lost_reason__reason_type__won +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_view_form +msgid "Won" +msgstr "Ganado" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead__won_reason_id +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__won_reason_id +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Won Reason" +msgstr "Razón Ganada" diff --git a/crm_won_reason/i18n/it.po b/crm_won_reason/i18n/it.po new file mode 100644 index 00000000000..da361a921b2 --- /dev/null +++ b/crm_won_reason/i18n/it.po @@ -0,0 +1,120 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_won_reason +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-06-14 14:09+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Cancel" +msgstr "Annulla" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead_lost +msgid "Get Lost Reason" +msgstr "Seleziona motivo perdita" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead_won +msgid "Get Won Reason" +msgstr "Seleziona motivo vincita" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__id +msgid "ID" +msgstr "ID" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Contatto/Opportunità" + +#. module: crm_won_reason +#: model:ir.model.fields.selection,name:crm_won_reason.selection__crm_lost_reason__reason_type__lost +msgid "Lost" +msgstr "Persa" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_lost__lost_reason_id +msgid "Lost Reason" +msgstr "Motivo dell'insuccesso" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_view_form +msgid "Mark as won" +msgstr "Segna come successo" + +#. module: crm_won_reason +#: model:ir.model,name:crm_won_reason.model_crm_lost_reason +msgid "Opp. Lost Reason" +msgstr "Motivo insuccesso opportunità" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lost_reason__reason_type +msgid "Reason Type" +msgstr "Tipo motivo" + +#. module: crm_won_reason +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Submit" +msgstr "Invia" + +#. module: crm_won_reason +#: model:ir.actions.act_window,name:crm_won_reason.crm_lead_win_action +msgid "Win Reason" +msgstr "Morivo successo" + +#. module: crm_won_reason +#: model:ir.model.fields.selection,name:crm_won_reason.selection__crm_lost_reason__reason_type__won +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_view_form +msgid "Won" +msgstr "Successo" + +#. module: crm_won_reason +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead__won_reason_id +#: model:ir.model.fields,field_description:crm_won_reason.field_crm_lead_won__won_reason_id +#: model_terms:ir.ui.view,arch_db:crm_won_reason.crm_lead_win_view_form +msgid "Won Reason" +msgstr "Morivo successo" diff --git a/crm_won_reason/models/__init__.py b/crm_won_reason/models/__init__.py new file mode 100644 index 00000000000..91a38a5195f --- /dev/null +++ b/crm_won_reason/models/__init__.py @@ -0,0 +1,2 @@ +from . import crm_lost_reason +from . import crm_lead diff --git a/crm_won_reason/models/crm_lead.py b/crm_won_reason/models/crm_lead.py new file mode 100644 index 00000000000..f3cf96868b4 --- /dev/null +++ b/crm_won_reason/models/crm_lead.py @@ -0,0 +1,10 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + won_reason_id = fields.Many2one("crm.lost.reason") diff --git a/crm_won_reason/models/crm_lost_reason.py b/crm_won_reason/models/crm_lost_reason.py new file mode 100644 index 00000000000..1d066133f03 --- /dev/null +++ b/crm_won_reason/models/crm_lost_reason.py @@ -0,0 +1,10 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class CrmLostReason(models.Model): + _inherit = "crm.lost.reason" + + reason_type = fields.Selection([("won", "Won"), ("lost", "Lost")], default="lost") diff --git a/crm_won_reason/pyproject.toml b/crm_won_reason/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/crm_won_reason/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/crm_won_reason/readme/CONTRIBUTORS.md b/crm_won_reason/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..bfe760cc704 --- /dev/null +++ b/crm_won_reason/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Anna Janiszewska \<\> diff --git a/crm_won_reason/readme/DESCRIPTION.md b/crm_won_reason/readme/DESCRIPTION.md new file mode 100644 index 00000000000..2d5674893db --- /dev/null +++ b/crm_won_reason/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module adds possibility to define lost & won reasons to be applied +on leads. diff --git a/crm_won_reason/security/ir.model.access.csv b/crm_won_reason/security/ir.model.access.csv new file mode 100644 index 00000000000..18876a19215 --- /dev/null +++ b/crm_won_reason/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_crm_lead_won,crm.lead.won,model_crm_lead_won,base.group_user,1,1,1,1 diff --git a/crm_won_reason/static/description/icon.png b/crm_won_reason/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/crm_won_reason/static/description/icon.png differ diff --git a/crm_won_reason/static/description/index.html b/crm_won_reason/static/description/index.html new file mode 100644 index 00000000000..edbe4b2ec64 --- /dev/null +++ b/crm_won_reason/static/description/index.html @@ -0,0 +1,426 @@ + + + + + +CRM won reason + + + +
+

CRM won reason

+ + +

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

+

This module adds possibility to define lost & won reasons to be applied +on leads.

+

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

+
    +
  • Camptocamp
  • +
+
+
+

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:

+

ajaniszewska-dev

+

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/crm_won_reason/tests/__init__.py b/crm_won_reason/tests/__init__.py new file mode 100644 index 00000000000..627fd6d64f9 --- /dev/null +++ b/crm_won_reason/tests/__init__.py @@ -0,0 +1 @@ +from . import test_crm_lead_reason diff --git a/crm_won_reason/tests/test_crm_lead_reason.py b/crm_won_reason/tests/test_crm_lead_reason.py new file mode 100644 index 00000000000..87c5c699bd8 --- /dev/null +++ b/crm_won_reason/tests/test_crm_lead_reason.py @@ -0,0 +1,49 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo.tests import Form +from odoo.tests.common import TransactionCase + + +class TestCrmLeadReason(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.crm_lead_model = cls.env["crm.lead"] + cls.lead_reason = cls.env["crm.lost.reason"] + cls.won_reason = cls.lead_reason.create( + {"name": "won reason 1", "reason_type": "won"} + ) + cls.lost_reason = cls.lead_reason.create( + {"name": "lost reason 1", "reason_type": "lost"} + ) + cls.unspecified_reason = cls.lead_reason.create({"name": "too expensive"}) + + def test_won_reason(self): + crm_lead = self.crm_lead_model.create({"name": "Testing lead won reason"}) + + wizard_model = self.env["crm.lead.won"].with_context( + active_id=crm_lead.id, active_model="crm.lead" + ) + wizard_form = Form(wizard_model) + wizard_form.won_reason_id = self.won_reason + wizard_id = wizard_form.save()["id"] + wizard_record = wizard_model.browse(wizard_id) + wizard_record.with_context(active_ids=crm_lead.id).action_win_reason_apply() + self.assertTrue(crm_lead.stage_id.is_won) + self.assertEqual(crm_lead.won_reason_id.name, self.won_reason.name) + + def test_lost_reason(self): + crm_lead = self.crm_lead_model.create({"name": "Testing lead lost reason"}) + crm_lead.action_set_lost(lost_reason_id=self.lost_reason) + self.assertFalse(crm_lead.stage_id.is_won) + self.assertEqual(crm_lead.lost_reason_id.name, self.lost_reason.name) + + def test_unspecified_reason(self): + crm_lead = self.crm_lead_model.create( + {"name": "Testing lead unspecified reason"} + ) + crm_lead.action_set_lost(lost_reason_id=self.unspecified_reason) + self.assertFalse(crm_lead.stage_id.is_won) + self.assertEqual(crm_lead.lost_reason_id.name, self.unspecified_reason.name) diff --git a/crm_won_reason/views/crm_views.xml b/crm_won_reason/views/crm_views.xml new file mode 100644 index 00000000000..ee143f8d9cb --- /dev/null +++ b/crm_won_reason/views/crm_views.xml @@ -0,0 +1,48 @@ + + + + Win or Lost Reasons + + + + + Win or Lost Reasons + + + + crm.lost.reason.tree.inherit + crm.lost.reason + + + + + + + + + + crm.lead.form.inherit + crm.lead + + + + + 1 + + +