From 1b4294a94a0cae967343ba0e4efd1a77e33ac399 Mon Sep 17 00:00:00 2001 From: Unai Beristain Date: Tue, 3 Sep 2024 10:55:44 +0200 Subject: [PATCH 1/3] [ADD] crm_lead_lost_reason_add_info --- crm_lead_lost_reason_add_info/README.rst | 62 ++++++++++++++ crm_lead_lost_reason_add_info/__init__.py | 1 + crm_lead_lost_reason_add_info/__manifest__.py | 18 +++++ .../i18n/crm_lead_lost_reason_add_info.pot | 80 +++++++++++++++++++ crm_lead_lost_reason_add_info/i18n/es.po | 80 +++++++++++++++++++ .../models/__init__.py | 1 + .../models/crm_lead.py | 30 +++++++ .../views/crm_lead_views.xml | 52 ++++++++++++ .../wizards/__init__.py | 1 + .../wizards/crm_lead_lost_reason_wizard.py | 55 +++++++++++++ .../crm_lead_lost_reason_wizard_views.xml | 19 +++++ 11 files changed, 399 insertions(+) create mode 100644 crm_lead_lost_reason_add_info/README.rst create mode 100644 crm_lead_lost_reason_add_info/__init__.py create mode 100644 crm_lead_lost_reason_add_info/__manifest__.py create mode 100644 crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot create mode 100644 crm_lead_lost_reason_add_info/i18n/es.po create mode 100644 crm_lead_lost_reason_add_info/models/__init__.py create mode 100644 crm_lead_lost_reason_add_info/models/crm_lead.py create mode 100644 crm_lead_lost_reason_add_info/views/crm_lead_views.xml create mode 100644 crm_lead_lost_reason_add_info/wizards/__init__.py create mode 100644 crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py create mode 100644 crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml diff --git a/crm_lead_lost_reason_add_info/README.rst b/crm_lead_lost_reason_add_info/README.rst new file mode 100644 index 00000000..ac32a7b7 --- /dev/null +++ b/crm_lead_lost_reason_add_info/README.rst @@ -0,0 +1,62 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=========================================== +CRM Lead Lost Reason Additional Information +=========================================== + +This module extends the CRM lead management system in Odoo by adding additional fields to capture detailed information about lost opportunities. It includes enhancements to both the lead form and the lost reason wizard to include competitor-related details. + +Features +======== + +- **Extended CRM Lead Form**: + Adds new fields to the CRM lead form to capture information about competitors when a lead is marked as lost. The fields include: + - Competitor Manufacturer + - Competitor Integrator + - Competitor Reseller + - Competitor Price + - Lost Reason Notes + +- **Enhanced Lost Reason Wizard**: + Includes the new fields in the lost reason wizard, allowing users to update or provide additional details when a lead is marked as lost. + +- **Automatic Field Population**: + The wizard automatically populates the fields with information from the CRM lead record when opening the wizard. + +Usage +===== + +Once installed, the module will: +- **Extend the CRM Lead Form**: + + - Navigate to CRM > Leads. + - Open a lead and check the "Competitor Details" group in the form view. + +- **Enhance the Lost Reason Wizard**: + - When marking a lead as lost, the wizard will now include additional fields for competitor information and lost reason notes. + +Configuration +============= + +No specific configuration is required. The module will automatically integrate with the existing CRM lead and lost reason views. + +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 smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ +* Ana Juaristi +* Unai Beristain + +Do not contact contributors directly about support or help with technical issues. + +License +======= +This project is licensed under the AGPL-3 License. For more details, please refer to the LICENSE file or visit . diff --git a/crm_lead_lost_reason_add_info/__init__.py b/crm_lead_lost_reason_add_info/__init__.py new file mode 100644 index 00000000..64face17 --- /dev/null +++ b/crm_lead_lost_reason_add_info/__init__.py @@ -0,0 +1 @@ +from . import models, wizards diff --git a/crm_lead_lost_reason_add_info/__manifest__.py b/crm_lead_lost_reason_add_info/__manifest__.py new file mode 100644 index 00000000..d8817013 --- /dev/null +++ b/crm_lead_lost_reason_add_info/__manifest__.py @@ -0,0 +1,18 @@ +{ + "name": "CRM Lead Lost Reason Additional Information", + "version": "14.0.1.0.0", + "summary": "Enhances CRM leads with detailed information on lost opportunities.", + "category": "Sales/CRM", + "author": "Avanzosc", + "website": "https://github.com/avanzosc/crm-addons", + "license": "AGPL-3", + "depends": [ + "crm", + ], + "data": [ + "views/crm_lead_views.xml", + "wizards/crm_lead_lost_reason_wizard_views.xml", + ], + "installable": True, + "auto_install": False, +} diff --git a/crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot b/crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot new file mode 100644 index 00000000..fee938fa --- /dev/null +++ b/crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot @@ -0,0 +1,80 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_lost_reason_add_info +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-20 09:51+0000\n" +"PO-Revision-Date: 2024-08-20 09:51+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: crm_lead_lost_reason_add_info +#: model_terms:ir.ui.view,arch_db:crm_lead_lost_reason_add_info.view_crm_lead_form_inherit +#: model_terms:ir.ui.view,arch_db:crm_lead_lost_reason_add_info.view_crm_lead_lost_reason_wizard_inherit +msgid "Competitor Details" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_integrator_id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_integrator_id +msgid "Competitor Integrator" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_manufacturer_id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_manufacturer_id +msgid "Competitor Manufacturer" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_price +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_price +msgid "Competitor Price" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_reseller_id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_reseller_id +msgid "Competitor Reseller" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__display_name +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__display_name +msgid "Display Name" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead_lost +msgid "Get Lost Reason" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__id +msgid "ID" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead____last_update +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost____last_update +msgid "Last Modified on" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__lost_reason_notes +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__lost_reason_notes +msgid "Lost Reason Notes" +msgstr "" diff --git a/crm_lead_lost_reason_add_info/i18n/es.po b/crm_lead_lost_reason_add_info/i18n/es.po new file mode 100644 index 00000000..bf333101 --- /dev/null +++ b/crm_lead_lost_reason_add_info/i18n/es.po @@ -0,0 +1,80 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_lost_reason_add_info +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-20 09:51+0000\n" +"PO-Revision-Date: 2024-08-20 09:51+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: crm_lead_lost_reason_add_info +#: model_terms:ir.ui.view,arch_db:crm_lead_lost_reason_add_info.view_crm_lead_form_inherit +#: model_terms:ir.ui.view,arch_db:crm_lead_lost_reason_add_info.view_crm_lead_lost_reason_wizard_inherit +msgid "Competitor Details" +msgstr "Detalles del Competidor" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_integrator_id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_integrator_id +msgid "Competitor Integrator" +msgstr "Integrador del Competidor" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_manufacturer_id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_manufacturer_id +msgid "Competitor Manufacturer" +msgstr "Fabricante del Competidor" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_price +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_price +msgid "Competitor Price" +msgstr "Precio del Competidor" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__competitor_reseller_id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__competitor_reseller_id +msgid "Competitor Reseller" +msgstr "Revendedor del Competidor" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__display_name +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead_lost +msgid "Get Lost Reason" +msgstr "Obtener razón de la pérdida" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__id +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__id +msgid "ID" +msgstr "ID" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead____last_update +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Lead/Oportunidad" + +#. module: crm_lead_lost_reason_add_info +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__lost_reason_notes +#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__lost_reason_notes +msgid "Lost Reason Notes" +msgstr "Notas sobre la razón de la pérdida" diff --git a/crm_lead_lost_reason_add_info/models/__init__.py b/crm_lead_lost_reason_add_info/models/__init__.py new file mode 100644 index 00000000..e66f0d6c --- /dev/null +++ b/crm_lead_lost_reason_add_info/models/__init__.py @@ -0,0 +1 @@ +from . import crm_lead diff --git a/crm_lead_lost_reason_add_info/models/crm_lead.py b/crm_lead_lost_reason_add_info/models/crm_lead.py new file mode 100644 index 00000000..b6cb6538 --- /dev/null +++ b/crm_lead_lost_reason_add_info/models/crm_lead.py @@ -0,0 +1,30 @@ +from odoo import fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + competitor_manufacturer_id = fields.Many2one( + "res.partner", + string="Competitor Manufacturer", + domain=[("is_company", "=", True)], + ) + competitor_integrator_id = fields.Many2one( + "res.partner", + string="Competitor Integrator", + domain=[("is_company", "=", True)], + ) + competitor_reseller_id = fields.Many2one( + "res.partner", + string="Competitor Reseller", + domain=[("is_company", "=", True)], + ) + competitor_price = fields.Float() + lost_reason_notes = fields.Text() + + def action_mark_lost(self): + """ + Extends the action to mark a lead as lost to include additional fields in the wizard. + """ + res = super().action_mark_lost() + return res diff --git a/crm_lead_lost_reason_add_info/views/crm_lead_views.xml b/crm_lead_lost_reason_add_info/views/crm_lead_views.xml new file mode 100644 index 00000000..c393a788 --- /dev/null +++ b/crm_lead_lost_reason_add_info/views/crm_lead_views.xml @@ -0,0 +1,52 @@ + + + + crm.lead.form.inherit + crm.lead + + + + + + + + + + + + + + + + crm.case.tree.view.leads + crm.lead + + + + + + + + + + + + + + crm.case.tree.view.leads + crm.lead + + + + + + + + + + + + diff --git a/crm_lead_lost_reason_add_info/wizards/__init__.py b/crm_lead_lost_reason_add_info/wizards/__init__.py new file mode 100644 index 00000000..cf624366 --- /dev/null +++ b/crm_lead_lost_reason_add_info/wizards/__init__.py @@ -0,0 +1 @@ +from . import crm_lead_lost_reason_wizard diff --git a/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py new file mode 100644 index 00000000..82404060 --- /dev/null +++ b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py @@ -0,0 +1,55 @@ +from odoo import api, fields, models + + +class CrmLeadLostReasonWizard(models.TransientModel): + _inherit = "crm.lead.lost" + + competitor_manufacturer_id = fields.Many2one( + "res.partner", + string="Competitor Manufacturer", + domain=[("is_company", "=", True)], + ) + competitor_integrator_id = fields.Many2one( + "res.partner", + string="Competitor Integrator", + domain=[("is_company", "=", True)], + ) + competitor_reseller_id = fields.Many2one( + "res.partner", + string="Competitor Reseller", + domain=[("is_company", "=", True)], + ) + competitor_price = fields.Float() + lost_reason_notes = fields.Text() + + @api.model + def default_get(self, fields): + res = super().default_get(fields) + lead = self.env["crm.lead"].browse(self.env.context.get("active_id")) + res.update( + { + "competitor_manufacturer_id": lead.competitor_manufacturer_id.id, + "competitor_integrator_id": lead.competitor_integrator_id.id, + "competitor_reseller_id": lead.competitor_reseller_id.id, + "competitor_price": lead.competitor_price, + "lost_reason_notes": lead.lost_reason_notes, + } + ) + return res + + def action_lost_reason_apply(self): + """ + Applies the lost reason and updates the lead with additional fields. + """ + res = super().action_lost_reason_apply() + lead = self.env["crm.lead"].browse(self.env.context.get("active_id")) + lead.write( + { + "competitor_manufacturer_id": self.competitor_manufacturer_id.id, + "competitor_integrator_id": self.competitor_integrator_id.id, + "competitor_reseller_id": self.competitor_reseller_id.id, + "competitor_price": self.competitor_price, + "lost_reason_notes": self.lost_reason_notes, + } + ) + return res diff --git a/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml new file mode 100644 index 00000000..c0c8b887 --- /dev/null +++ b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml @@ -0,0 +1,19 @@ + + + + crm.lead.lost.reason.wizard.inherit + crm.lead.lost + + + + + + + + + + + + + + From a376bc0b8a72beb78f1fb0315d640e1b48df3166 Mon Sep 17 00:00:00 2001 From: luciaavanzosc Date: Mon, 23 Mar 2026 14:37:28 +0100 Subject: [PATCH 2/3] [18.0][MIG] crm_lead_lost_reason_add_info: Migration to 18.0. --- crm_lead_lost_reason_add_info/README.rst | 1 + crm_lead_lost_reason_add_info/__manifest__.py | 2 +- .../i18n/crm_lead_lost_reason_add_info.pot | 24 ++---------- crm_lead_lost_reason_add_info/i18n/es.po | 26 ++----------- .../models/crm_lead.py | 7 ---- .../views/crm_lead_views.xml | 9 ++--- .../wizards/crm_lead_lost_reason_wizard.py | 38 ++++++++++--------- 7 files changed, 32 insertions(+), 75 deletions(-) diff --git a/crm_lead_lost_reason_add_info/README.rst b/crm_lead_lost_reason_add_info/README.rst index ac32a7b7..3948187d 100644 --- a/crm_lead_lost_reason_add_info/README.rst +++ b/crm_lead_lost_reason_add_info/README.rst @@ -54,6 +54,7 @@ Contributors ------------ * Ana Juaristi * Unai Beristain +* Lucía Echeverría Do not contact contributors directly about support or help with technical issues. diff --git a/crm_lead_lost_reason_add_info/__manifest__.py b/crm_lead_lost_reason_add_info/__manifest__.py index d8817013..372d4f8c 100644 --- a/crm_lead_lost_reason_add_info/__manifest__.py +++ b/crm_lead_lost_reason_add_info/__manifest__.py @@ -1,6 +1,6 @@ { "name": "CRM Lead Lost Reason Additional Information", - "version": "14.0.1.0.0", + "version": "18.0.1.0.0", "summary": "Enhances CRM leads with detailed information on lost opportunities.", "category": "Sales/CRM", "author": "Avanzosc", diff --git a/crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot b/crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot index fee938fa..51a17ba5 100644 --- a/crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot +++ b/crm_lead_lost_reason_add_info/i18n/crm_lead_lost_reason_add_info.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-20 09:51+0000\n" -"PO-Revision-Date: 2024-08-20 09:51+0000\n" +"POT-Creation-Date: 2026-03-23 13:31+0000\n" +"PO-Revision-Date: 2026-03-23 13:31+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -45,29 +45,11 @@ msgstr "" msgid "Competitor Reseller" msgstr "" -#. module: crm_lead_lost_reason_add_info -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__display_name -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__display_name -msgid "Display Name" -msgstr "" - #. module: crm_lead_lost_reason_add_info #: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead_lost msgid "Get Lost Reason" msgstr "" -#. module: crm_lead_lost_reason_add_info -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__id -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__id -msgid "ID" -msgstr "" - -#. module: crm_lead_lost_reason_add_info -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead____last_update -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost____last_update -msgid "Last Modified on" -msgstr "" - #. module: crm_lead_lost_reason_add_info #: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead msgid "Lead/Opportunity" diff --git a/crm_lead_lost_reason_add_info/i18n/es.po b/crm_lead_lost_reason_add_info/i18n/es.po index bf333101..4cab4c25 100644 --- a/crm_lead_lost_reason_add_info/i18n/es.po +++ b/crm_lead_lost_reason_add_info/i18n/es.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-20 09:51+0000\n" -"PO-Revision-Date: 2024-08-20 09:51+0000\n" +"POT-Creation-Date: 2026-03-23 13:31+0000\n" +"PO-Revision-Date: 2026-03-23 13:31+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -45,28 +45,10 @@ msgstr "Precio del Competidor" msgid "Competitor Reseller" msgstr "Revendedor del Competidor" -#. module: crm_lead_lost_reason_add_info -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__display_name -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__display_name -msgid "Display Name" -msgstr "Nombre mostrado" - #. module: crm_lead_lost_reason_add_info #: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead_lost msgid "Get Lost Reason" -msgstr "Obtener razón de la pérdida" - -#. module: crm_lead_lost_reason_add_info -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead__id -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost__id -msgid "ID" -msgstr "ID" - -#. module: crm_lead_lost_reason_add_info -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead____last_update -#: model:ir.model.fields,field_description:crm_lead_lost_reason_add_info.field_crm_lead_lost____last_update -msgid "Last Modified on" -msgstr "Última modificación el" +msgstr "Obtener razón de pérdida" #. module: crm_lead_lost_reason_add_info #: model:ir.model,name:crm_lead_lost_reason_add_info.model_crm_lead diff --git a/crm_lead_lost_reason_add_info/models/crm_lead.py b/crm_lead_lost_reason_add_info/models/crm_lead.py index b6cb6538..3ae71a79 100644 --- a/crm_lead_lost_reason_add_info/models/crm_lead.py +++ b/crm_lead_lost_reason_add_info/models/crm_lead.py @@ -21,10 +21,3 @@ class CrmLead(models.Model): ) competitor_price = fields.Float() lost_reason_notes = fields.Text() - - def action_mark_lost(self): - """ - Extends the action to mark a lead as lost to include additional fields in the wizard. - """ - res = super().action_mark_lost() - return res diff --git a/crm_lead_lost_reason_add_info/views/crm_lead_views.xml b/crm_lead_lost_reason_add_info/views/crm_lead_views.xml index c393a788..215390f4 100644 --- a/crm_lead_lost_reason_add_info/views/crm_lead_views.xml +++ b/crm_lead_lost_reason_add_info/views/crm_lead_views.xml @@ -6,10 +6,7 @@ - + @@ -25,7 +22,7 @@ crm.lead - + @@ -40,7 +37,7 @@ crm.lead - + diff --git a/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py index 82404060..4214917b 100644 --- a/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py +++ b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard.py @@ -26,15 +26,16 @@ class CrmLeadLostReasonWizard(models.TransientModel): def default_get(self, fields): res = super().default_get(fields) lead = self.env["crm.lead"].browse(self.env.context.get("active_id")) - res.update( - { - "competitor_manufacturer_id": lead.competitor_manufacturer_id.id, - "competitor_integrator_id": lead.competitor_integrator_id.id, - "competitor_reseller_id": lead.competitor_reseller_id.id, - "competitor_price": lead.competitor_price, - "lost_reason_notes": lead.lost_reason_notes, - } - ) + if lead: + res.update( + { + "competitor_manufacturer_id": lead.competitor_manufacturer_id.id, + "competitor_integrator_id": lead.competitor_integrator_id.id, + "competitor_reseller_id": lead.competitor_reseller_id.id, + "competitor_price": lead.competitor_price, + "lost_reason_notes": lead.lost_reason_notes, + } + ) return res def action_lost_reason_apply(self): @@ -43,13 +44,14 @@ def action_lost_reason_apply(self): """ res = super().action_lost_reason_apply() lead = self.env["crm.lead"].browse(self.env.context.get("active_id")) - lead.write( - { - "competitor_manufacturer_id": self.competitor_manufacturer_id.id, - "competitor_integrator_id": self.competitor_integrator_id.id, - "competitor_reseller_id": self.competitor_reseller_id.id, - "competitor_price": self.competitor_price, - "lost_reason_notes": self.lost_reason_notes, - } - ) + if lead: + lead.write( + { + "competitor_manufacturer_id": self.competitor_manufacturer_id.id, + "competitor_integrator_id": self.competitor_integrator_id.id, + "competitor_reseller_id": self.competitor_reseller_id.id, + "competitor_price": self.competitor_price, + "lost_reason_notes": self.lost_reason_notes, + } + ) return res From e4b7432209dcc5dc8c48dcad06c2c70a2b69f109 Mon Sep 17 00:00:00 2001 From: luciaavanzosc Date: Mon, 23 Mar 2026 14:38:13 +0100 Subject: [PATCH 3/3] [IMP] : pre-commit auto fixes --- crm_lead_lost_reason_add_info/pyproject.toml | 3 + .../views/crm_lead_views.xml | 88 +++++++++---------- .../crm_lead_lost_reason_wizard_views.xml | 32 +++---- 3 files changed, 63 insertions(+), 60 deletions(-) create mode 100644 crm_lead_lost_reason_add_info/pyproject.toml diff --git a/crm_lead_lost_reason_add_info/pyproject.toml b/crm_lead_lost_reason_add_info/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/crm_lead_lost_reason_add_info/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/crm_lead_lost_reason_add_info/views/crm_lead_views.xml b/crm_lead_lost_reason_add_info/views/crm_lead_views.xml index 215390f4..7b1690ba 100644 --- a/crm_lead_lost_reason_add_info/views/crm_lead_views.xml +++ b/crm_lead_lost_reason_add_info/views/crm_lead_views.xml @@ -1,49 +1,49 @@ - - crm.lead.form.inherit - crm.lead - - - - - - - - - - - - - + + crm.lead.form.inherit + crm.lead + + + + + + + + + + + + + - - crm.case.tree.view.leads - crm.lead - - - - - - - - - - - + + crm.case.tree.view.leads + crm.lead + + + + + + + + + + + - - crm.case.tree.view.leads - crm.lead - - - - - - - - - - - + + crm.case.tree.view.leads + crm.lead + + + + + + + + + + + diff --git a/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml index c0c8b887..ee9a52ad 100644 --- a/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml +++ b/crm_lead_lost_reason_add_info/wizards/crm_lead_lost_reason_wizard_views.xml @@ -1,19 +1,19 @@ - - crm.lead.lost.reason.wizard.inherit - crm.lead.lost - - - - - - - - - - - - - + + crm.lead.lost.reason.wizard.inherit + crm.lead.lost + + + + + + + + + + + + +