Skip to content

Commit 51caa76

Browse files
committed
[T-8592][MIG] partner_code_program: migration to 18.0
1 parent 1f91dd1 commit 51caa76

11 files changed

Lines changed: 104 additions & 40 deletions

partner_code_program/README.rst

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
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-
51
====================
62
Partner code program
73
====================
84

9-
This module adds the partner code program model, a new field in the res partner address
10-
that would be added to all the countries address format.
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:5bfd6887b967f751d58898fa5c01bd5dc53edf987344b4c316450324882d53a7
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1112
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-sygel--technology%2Fsy--partner--contact-lightgray.png?logo=github
20+
:target: https://github.com/sygel-technology/sy-partner-contact/tree/18.0/partner_code_program
21+
:alt: sygel-technology/sy-partner-contact
1222

13-
Usage
14-
=====
23+
|badge1| |badge2| |badge3|
1524

16-
To use this module, you need to:
25+
This module adds the partner code program model, a new field in the res
26+
partner address that would be added to all the countries address format.
1727

18-
#. Create new program codes in Contacts / Configuration / Code Programs
19-
#. Edit the code program of a partner of type company in the address field of the partner form
28+
**Table of contents**
2029

30+
.. contents::
31+
:local:
2132

2233
Installation
2334
============
@@ -26,52 +37,51 @@ To install this module, you need to:
2637

2738
#. Only install
2839

29-
3040
Configuration
3141
=============
3242

3343
To configure this module, you need to:
3444

3545
#. Only install
3646

47+
Usage
48+
=====
49+
50+
To use this module, you need to:
51+
52+
#. Create new program codes in Contacts / Configuration / Code Programs
53+
#. Edit the code program of a partner of type company in the address
54+
field of the partner form
3755

3856
Bug Tracker
3957
===========
4058

41-
Bugs and errors are managed in `issues of GitHub <https://github.com/sygel-technology/sy-partner-contact/issues>`_.
42-
In case of problems, please check if your problem has already been
43-
reported. If you are the first to discover it, help us solving it by indicating
44-
a detailed description `here <https://github.com/sygel-technology/sy-partner-contact/issues/new>`_.
59+
Bugs are tracked on `GitHub Issues <https://github.com/sygel-technology/sy-partner-contact/issues>`_.
60+
In case of trouble, please check there if your issue has already been reported.
61+
If you spotted it first, help us to smash it by providing a detailed and welcomed
62+
`feedback <https://github.com/sygel-technology/sy-partner-contact/issues/new?body=module:%20partner_code_program%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
4563

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

48-
4966
Credits
5067
=======
5168

5269
Authors
53-
~~~~~~~
54-
55-
* Sygel, Odoo Community Association (OCA)
70+
-------
5671

72+
* Sygel
5773

5874
Contributors
59-
~~~~~~~~~~~~
60-
61-
* Valentin Vinagre <valentin.vinagre@sygel.es>
62-
* Alberto Martínez <alberto.martinez@sygel.es>
63-
64-
65-
Maintainer
66-
~~~~~~~~~~
75+
------------
6776

68-
This module is maintained by Sygel.
77+
- `Sygel <https://www.sygel.es>`__:
6978

70-
.. image:: https://www.sygel.es/logo.png
71-
:alt: Sygel
72-
:target: https://www.sygel.es
79+
- Valentín Vinagre
80+
- Alberto Martínez
7381

74-
This module is part of the `Sygel/sy-partner-contact <https://github.com/sygel-technology/sy-partner-contact>`_.
82+
Maintainers
83+
-----------
7584

76-
To contribute to this module, please visit https://github.com/sygel-technology/.
85+
This module is part of the `sygel-technology/sy-partner-contact <https://github.com/sygel-technology/sy-partner-contact/tree/18.0/partner_code_program>`_ project on GitHub.
7786

87+
You are welcome to contribute.

partner_code_program/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Partner code program",
55
"summary": "Adds the partner code program fields on contacts",
6-
"version": "17.0.1.0.0",
6+
"version": "18.0.1.0.0",
77
"category": "Partner Management",
88
"website": "https://github.com/sygel-technology/sy-partner-contact",
99
"author": "Sygel",

partner_code_program/models/res_partner_code_program.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2024 Alberto Martínez <alberto.martinez@sygel.es>
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

4-
from odoo import _, fields, models
4+
from odoo import fields, models
55

66

77
class ResPartnerCodeProgram(models.Model):
@@ -28,7 +28,7 @@ def action_view_res_partner(self):
2828
return {
2929
"type": "ir.actions.act_window",
3030
"res_model": "res.partner",
31-
"name": _("Contacts"),
31+
"name": self.env._("Contacts"),
3232
"views": [(False, "tree"), (False, "form")],
3333
"domain": [("code_program_id", "=", self.id)],
3434
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To configure this module, you need to:
2+
3+
#. Only install
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- [Sygel](https://www.sygel.es):
2+
- Valentín Vinagre
3+
- Alberto Martínez
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module adds the partner code program model, a new field in the res partner address
2+
that would be added to all the countries address format.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To install this module, you need to:
2+
3+
#. Only install
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
To use this module, you need to:
2+
3+
#. Create new program codes in Contacts / Configuration / Code Programs
4+
#. Edit the code program of a partner of type company in the address field of the partner form
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_partner_code_program
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from odoo.tests.common import TransactionCase
2+
3+
4+
class TestPartnerCodeProgram(TransactionCase):
5+
6+
@classmethod
7+
def setUpClass(cls):
8+
super().setUpClass()
9+
cls.partner_code_program = cls.env["res.partner.code.program"].create({
10+
"name": "Program test",
11+
"code": "CP-001",
12+
})
13+
14+
cls.partner = cls.env["res.partner"].create({
15+
"name": "Partner test",
16+
"code_program_id": cls.partner_code_program.id,
17+
})
18+
19+
def test_address_fields(self):
20+
address_fields = self.partner._address_fields()
21+
self.assertIn("code_program_id", address_fields)
22+
self.assertIn("code_program_name", address_fields)
23+
24+
def test_commercial_fields(self):
25+
commercial_fields = self.partner._commercial_fields()
26+
self.assertIn("code_program_id", commercial_fields)
27+
28+
def test_compute_res_partner_count(self):
29+
self.partner_code_program._compute_res_partner_count()
30+
self.assertEqual(self.partner_code_program.res_partner_count, 1)
31+
32+
def test_action_view_res_partner(self):
33+
action = self.partner_code_program.action_view_res_partner()
34+
self.assertEqual(action["res_model"], "res.partner")
35+
self.assertIn(("code_program_id", "=", self.partner_code_program.id), action["domain"])
36+
37+
38+

0 commit comments

Comments
 (0)