diff --git a/crm_lead_phone_secondary/README.rst b/crm_lead_phone_secondary/README.rst new file mode 100644 index 00000000000..d20af9d5fef --- /dev/null +++ b/crm_lead_phone_secondary/README.rst @@ -0,0 +1,77 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=============================== +Secondary phone number on leads +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:61c2b7c02507cc19dd58043a349d386e1292998041430f63f5270adbe1761b84 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/19.0/crm_lead_phone_secondary + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-19-0/partner-contact-19-0-crm_lead_phone_secondary + :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/partner-contact&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds a secondary phone number 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 +======= + +Contributors +------------ + +- `ForgeFlow `__: + + - Andreu Orensanz + +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. + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/crm_lead_phone_secondary/__init__.py b/crm_lead_phone_secondary/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/crm_lead_phone_secondary/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/crm_lead_phone_secondary/__manifest__.py b/crm_lead_phone_secondary/__manifest__.py new file mode 100644 index 00000000000..1c79ffa99a2 --- /dev/null +++ b/crm_lead_phone_secondary/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Secondary phone number on leads", + "summary": "Adds a secondary phone number on CRM leads", + "license": "AGPL-3", + "version": "19.0.1.0.0", + "author": "Odoo Community Association (OCA)", + "category": "Customer Relationship Management", + "depends": ["crm", "partner_phone_secondary"], + "website": "https://github.com/OCA/partner-contact", + "data": ["views/crm_lead.xml"], + "installable": True, +} diff --git a/crm_lead_phone_secondary/i18n/es.po b/crm_lead_phone_secondary/i18n/es.po new file mode 100644 index 00000000000..f829865e190 --- /dev/null +++ b/crm_lead_phone_secondary/i18n/es.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_lead_phone_secondary +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-01-21 09:35+0000\n" +"PO-Revision-Date: 2026-01-21 09:35+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_phone_secondary +#: model:ir.model.fields,field_description:crm_lead_phone_secondary.field_crm_lead__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: crm_lead_phone_secondary +#: model:ir.model.fields,field_description:crm_lead_phone_secondary.field_crm_lead__id +msgid "ID" +msgstr "ID" + +#. module: crm_lead_phone_secondary +#: model:ir.model,name:crm_lead_phone_secondary.model_crm_lead +msgid "Lead" +msgstr "Lead" + +#. module: crm_lead_phone_secondary +#: model:ir.model.fields,field_description:crm_lead_phone_secondary.field_crm_lead__phone2 +msgid "Phone (Secondary)" +msgstr "Teléfono (Secundario)" diff --git a/crm_lead_phone_secondary/models/__init__.py b/crm_lead_phone_secondary/models/__init__.py new file mode 100644 index 00000000000..e66f0d6cf4e --- /dev/null +++ b/crm_lead_phone_secondary/models/__init__.py @@ -0,0 +1 @@ +from . import crm_lead diff --git a/crm_lead_phone_secondary/models/crm_lead.py b/crm_lead_phone_secondary/models/crm_lead.py new file mode 100644 index 00000000000..367e18c0717 --- /dev/null +++ b/crm_lead_phone_secondary/models/crm_lead.py @@ -0,0 +1,52 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + phone2 = fields.Char( + "Phone (Secondary)", + compute="_compute_phone2", + inverse="_inverse_phone2", + readonly=False, + store=True, + ) + + def _get_partner_phone2_update(self, force_void=True): + self.ensure_one() + if ( + self.partner_id + and (force_void or self.phone2) + and self.phone2 != self.partner_id.phone2 + ): + lead_phone2_formatted = ( + self._phone_format(fname="phone2") or self.phone2 or False + ) + partner_phone2_formatted = ( + self.partner_id._phone_format(fname="phone2") + or self.partner_id.phone2 + or False + ) + return lead_phone2_formatted != partner_phone2_formatted + return False + + def _inverse_phone2(self): + for lead in self: + if lead._get_partner_phone2_update(force_void=False): + lead.partner_id.phone2 = lead.phone2 + + @api.depends("partner_id.phone2") + def _compute_phone2(self): + for lead in self: + if lead.partner_id.phone2 and lead._get_partner_phone2_update(): + lead.phone2 = lead.partner_id.phone2 + + def _prepare_customer_values(self, partner_name, is_company=False, parent_id=False): + res = super()._prepare_customer_values( + partner_name, is_company=is_company, parent_id=parent_id + ) + res["phone2"] = self.phone2 + return res diff --git a/crm_lead_phone_secondary/pyproject.toml b/crm_lead_phone_secondary/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/crm_lead_phone_secondary/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/crm_lead_phone_secondary/readme/CONTRIBUTORS.md b/crm_lead_phone_secondary/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..a08aabd4dfc --- /dev/null +++ b/crm_lead_phone_secondary/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [ForgeFlow](https://forgeflow.com): + + > - Andreu Orensanz \<\> diff --git a/crm_lead_phone_secondary/readme/DESCRIPTION.md b/crm_lead_phone_secondary/readme/DESCRIPTION.md new file mode 100644 index 00000000000..6ba3956a055 --- /dev/null +++ b/crm_lead_phone_secondary/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Adds a secondary phone number on leads diff --git a/crm_lead_phone_secondary/static/description/index.html b/crm_lead_phone_secondary/static/description/index.html new file mode 100644 index 00000000000..52afc7df3fb --- /dev/null +++ b/crm_lead_phone_secondary/static/description/index.html @@ -0,0 +1,428 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Secondary phone number on leads

+ +

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

+

Adds a secondary phone number 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

+
+

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.

+

This module is part of the OCA/partner-contact project on GitHub.

+

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

+
+
+
+
+ + diff --git a/crm_lead_phone_secondary/views/crm_lead.xml b/crm_lead_phone_secondary/views/crm_lead.xml new file mode 100644 index 00000000000..f63ab5c18f5 --- /dev/null +++ b/crm_lead_phone_secondary/views/crm_lead.xml @@ -0,0 +1,27 @@ + + + + crm.lead + + + + + + + + + diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000000..5088f260c4f --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-partner_phone_secondary @ git+https://github.com/OCA/partner-contact.git@refs/pull/2247/head#subdirectory=partner_phone_secondary