Skip to content

Commit fca20f0

Browse files
Tisho99Sygel-bot
authored andcommitted
[T-6642][ADD] partner_contact_show_ref
1 parent 6d43b51 commit fca20f0

9 files changed

Lines changed: 156 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl
3+
:alt: License: AGPL-3
4+
5+
========================
6+
Partner Contact Show Ref
7+
========================
8+
9+
Show the contact reference in the contact name
10+
11+
12+
Installation
13+
============
14+
15+
To install this module, you need to:
16+
17+
#. Only install
18+
19+
20+
Configuration
21+
=============
22+
23+
To configure this module, you need to:
24+
25+
#. Only install
26+
27+
28+
Usage
29+
=====
30+
31+
To use this module, you need to:
32+
33+
#. Go to a partner form of type company
34+
#. In the "Sales and Purchase" tab, fill the "Reference" field.
35+
#. The partner name will show the reference. The reference will also be shown in all of the partner childrens
36+
37+
38+
ROADMAP
39+
=======
40+
41+
[ Enumerate known caveats and future potential improvements.
42+
It is mostly intended for end-users, and can also help
43+
potential new contributors discovering new features to implement. ]
44+
45+
* ...
46+
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs and errors are managed in `issues of GitHub <https://github.com/sygel-technology/REPOSITORY/issues>`_.
52+
In case of problems, please check if your problem has already been
53+
reported. If you are the first to discover it, help us solving it by indicating
54+
a detailed description `here <https://github.com/sygel-technology/REPOSITORY/issues/new>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
59+
Credits
60+
=======
61+
62+
Authors
63+
~~~~~~~
64+
65+
* Sygel, Odoo Community Association (OCA)
66+
67+
68+
Contributors
69+
~~~~~~~~~~~~
70+
71+
* Valentin Vinagre <valentin.vinagre@sygel.es>
72+
* Alberto Martínez <alberto.martinez@sygel.es>
73+
74+
75+
Maintainer
76+
~~~~~~~~~~
77+
78+
This module is maintained by Sygel.
79+
80+
.. image:: https://www.sygel.es/logo.png
81+
:alt: Sygel
82+
:target: https://www.sygel.es
83+
84+
This module is part of the `Sygel/REPOSITORY <https://github.com/sygel-technology/REPOSITORY>`_.
85+
86+
To contribute to this module, please visit https://github.com/sygel-technology/.
87+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Partner Contact Show Ref",
5+
"summary": "Shows contact ref in contact name",
6+
"version": "17.0.1.0.0",
7+
"category": "Tools",
8+
"website": "https://github.com/sygel-technology/sy-partner-contact",
9+
"author": "Sygel, Odoo Community Association (OCA)",
10+
"license": "AGPL-3",
11+
"application": False,
12+
"installable": True,
13+
"depends": [
14+
"base",
15+
],
16+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import res_partner
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class Partner(models.Model):
8+
_inherit = "res.partner"
9+
10+
def _get_complete_name(self):
11+
name = super()._get_complete_name()
12+
if self.commercial_partner_id.ref:
13+
name = f"[{self.commercial_partner_id.ref}] {name}"
14+
return name
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
35 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import test_partner_contact_show_ref
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo.tests.common import TransactionCase
5+
6+
7+
class TestPartnerContactShowRef(TransactionCase):
8+
@classmethod
9+
def setUpClass(cls):
10+
super().setUpClass()
11+
partner_model = cls.env["res.partner"]
12+
cls.test_company = partner_model.create(
13+
{"name": "Test Company", "company_type": "company"}
14+
)
15+
cls.test_person = partner_model.create(
16+
{
17+
"name": "Test Person",
18+
"parent_id": cls.test_company.id,
19+
"company_type": "person",
20+
}
21+
)
22+
23+
def test_partner_contact_show_ref(self):
24+
ref = "Fer"
25+
self.test_company.ref = ref
26+
self.assertIn(ref, self.test_person.display_name)
27+
self.assertIn(ref, self.test_company.display_name)

0 commit comments

Comments
 (0)