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
34 changes: 34 additions & 0 deletions sale_contact_subtype_followers/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.. 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

==============================
Sale Contact Subtype Followers
==============================

* This module removes the functionality of the system that assigns different
child contacts depending on their type. In this way, the contact type is only
used for informational purposes and the shipping address is not automatically
assigned, for example, in pickings on delivery address.
* To allow this functionality to work anywhere in the system, this code replaces
the values ​​generated by the "address_get" method with the same selected base
contact.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/sale-addons/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.

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

Credits
=======

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

* Ana Juaristi <anajuaristi@avanzosc.es>
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
1 change: 1 addition & 0 deletions sale_contact_subtype_followers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
12 changes: 12 additions & 0 deletions sale_contact_subtype_followers/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2026 Alfredo de la fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Contact Subtype Followers",
"version": "18.0.1.0.0",
"category": "Sales",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/sale-addons",
"depends": ["base"],
"installable": True,
}
1 change: 1 addition & 0 deletions sale_contact_subtype_followers/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
34 changes: 34 additions & 0 deletions sale_contact_subtype_followers/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2026 Alfredo de la fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models

from odoo.addons.base.models.res_partner import Partner as BaseResPartner


class ResPartner(models.Model):
_inherit = "res.partner"

def address_get_override_no_assign_subtype_contact(self, adr_pref=None):
"""
Reemplaza el funcionamiento de base del método "address_get" de forma
que siempre se retorne el mismo contacto original.

:param adr_pref: Listado de direcciones a buscar, defaults to None
:type adr_pref: set[str], optional
:returns dict[int] Diccionario con el conjunto de direcciones y su
correspondiente dirección (en este caso, siempre `self.id`).
"""
result = dict()
adr_pref = set(adr_pref or [])

if "contact" not in adr_pref:
adr_pref.add("contact")

for address_type in adr_pref:
result[address_type] = self.id

return result


# XXX: Override del método para respetar herencias.
BaseResPartner.address_get = ResPartner.address_get_override_no_assign_subtype_contact
3 changes: 3 additions & 0 deletions sale_contact_subtype_followers/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Loading