Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions crm_lead_phone_secondary/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/partner-contact/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 <https://github.com/OCA/partner-contact/issues/new?body=module:%20crm_lead_phone_secondary%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Contributors
------------

- `ForgeFlow <https://forgeflow.com>`__:

- Andreu Orensanz <andreu.orensanz@forgeflow.com>

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 <https://github.com/OCA/partner-contact/tree/19.0/crm_lead_phone_secondary>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions crm_lead_phone_secondary/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions crm_lead_phone_secondary/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
36 changes: 36 additions & 0 deletions crm_lead_phone_secondary/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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)"
1 change: 1 addition & 0 deletions crm_lead_phone_secondary/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import crm_lead
52 changes: 52 additions & 0 deletions crm_lead_phone_secondary/models/crm_lead.py
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions crm_lead_phone_secondary/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions crm_lead_phone_secondary/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ForgeFlow](https://forgeflow.com):

> - Andreu Orensanz \<<andreu.orensanz@forgeflow.com>\>
1 change: 1 addition & 0 deletions crm_lead_phone_secondary/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds a secondary phone number on leads
Loading
Loading