From 6073506b1fff341e4c68820ef59ca95b9553fadb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?=
Date: Tue, 27 Dec 2022 00:21:22 +0100
Subject: [PATCH] [MIG] partner_identification: Migration to 15.0
---
partner_identification/README.rst | 13 +++++++------
partner_identification/models/res_partner.py | 12 ++++++++----
.../models/res_partner_id_category.py | 17 ++++++++---------
.../models/res_partner_id_number.py | 2 +-
partner_identification/readme/CONTRIBUTORS.rst | 1 +
.../static/description/index.html | 7 ++++---
.../tests/test_res_partner.py | 2 +-
.../views/res_partner_id_category_view.xml | 2 +-
.../views/res_partner_id_number_view.xml | 2 +-
9 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/partner_identification/README.rst b/partner_identification/README.rst
index d075407f038d..dedc1feda6e1 100644
--- a/partner_identification/README.rst
+++ b/partner_identification/README.rst
@@ -14,16 +14,16 @@ Partner Identification Numbers
: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/14.0/partner_identification
+ :target: https://github.com/OCA/partner-contact/tree/15.0/partner_identification
: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-14-0/partner-contact-14-0-partner_identification
+ :target: https://translation.odoo-community.org/projects/partner-contact-15-0/partner-contact-15-0-partner_identification
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/134/14.0
+ :target: https://runbot.odoo-community.org/runbot/134/15.0
:alt: Try me on Runbot
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to manage all sort of identification numbers
and certificates which are assigned to a partner (company or individual)
@@ -97,7 +97,7 @@ 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 smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -126,6 +126,7 @@ Contributors
* Simone Orsi
* Dennis Sluijk
* Phuc Tran Thanh
+* Marie Lejeune
Other credits
~~~~~~~~~~~~~
@@ -147,6 +148,6 @@ 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.
+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/partner_identification/models/res_partner.py b/partner_identification/models/res_partner.py
index 497e428bb0bf..83951a336340 100644
--- a/partner_identification/models/res_partner.py
+++ b/partner_identification/models/res_partner.py
@@ -125,11 +125,15 @@ def _inverse_identification(self, field_name, category_code):
else:
raise ValidationError(
_(
- "This %s has multiple IDs of this type (%s), so a write "
- "via the %s field is not possible. In order to fix this, "
- "please use the IDs tab."
+ "This {record_name} has multiple IDs of this "
+ "type ({category_code}), so a write via the "
+ "{field_name} field is not possible. "
+ "In order to fix this, please use the IDs tab."
+ ).format(
+ record_name=record._name,
+ category_code=category_code,
+ field_name=field_name,
)
- % (record._name, category_code, field_name)
)
@api.model
diff --git a/partner_identification/models/res_partner_id_category.py b/partner_identification/models/res_partner_id_category.py
index 999cc606399c..555f4425618c 100644
--- a/partner_identification/models/res_partner_id_category.py
+++ b/partner_identification/models/res_partner_id_category.py
@@ -25,8 +25,6 @@ def _get_default_color(self):
color = fields.Integer(string="Color Index", default=_get_default_color)
code = fields.Char(
- string="Code",
- size=16,
required=True,
help="Abbreviation or acronym of this ID type. For example, "
"'driver_license'",
@@ -37,7 +35,7 @@ def _get_default_color(self):
translate=True,
help="Name of this ID type. For example, 'Driver License'",
)
- active = fields.Boolean(string="Active", default=True)
+ active = fields.Boolean(default=True)
validation_code = fields.Text(
"Python validation code", help="Python code called to validate an id number."
)
@@ -60,12 +58,13 @@ def validate_id_number(self, id_number):
except Exception as e:
raise UserError(
_(
- "Error when evaluating the id_category validation code:"
- ":\n %s \n(%s)"
- )
- % (self.name, e)
- )
+ "Error when evaluating the id_category "
+ "validation code: \n {name} \n({error})"
+ ).format(name=self.name, error=e)
+ ) from e
if eval_context.get("failed", False):
raise ValidationError(
- _("%s is not a valid %s identifier") % (id_number.name, self.name)
+ _("{id_name} is not a valid {cat_name} identifier").format(
+ id_name=id_number.name, cat_name=self.name
+ )
)
diff --git a/partner_identification/models/res_partner_id_number.py b/partner_identification/models/res_partner_id_number.py
index 22323e9aa241..34c80b28c12e 100644
--- a/partner_identification/models/res_partner_id_number.py
+++ b/partner_identification/models/res_partner_id_number.py
@@ -67,7 +67,7 @@ def validate_id_number(self):
("close", "Expired"),
]
)
- active = fields.Boolean(string="Active", default=True)
+ active = fields.Boolean(default=True)
@api.model
def default_get(self, fields):
diff --git a/partner_identification/readme/CONTRIBUTORS.rst b/partner_identification/readme/CONTRIBUTORS.rst
index 9cd3a91ec644..54746e292f4f 100644
--- a/partner_identification/readme/CONTRIBUTORS.rst
+++ b/partner_identification/readme/CONTRIBUTORS.rst
@@ -7,3 +7,4 @@
* Simone Orsi
* Dennis Sluijk
* Phuc Tran Thanh
+* Marie Lejeune
diff --git a/partner_identification/static/description/index.html b/partner_identification/static/description/index.html
index 05b14662e7b4..b2e0f943c788 100644
--- a/partner_identification/static/description/index.html
+++ b/partner_identification/static/description/index.html
@@ -367,7 +367,7 @@ Partner Identification Numbers
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
![Try me on Runbot](https://img.shields.io/badge/runbot-Try%20me-875A7B.png)
+
![Try me on Runbot](https://img.shields.io/badge/runbot-Try%20me-875A7B.png)
This module allows to manage all sort of identification numbers
and certificates which are assigned to a partner (company or individual)
and vary from country to country.
@@ -451,7 +451,7 @@
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 smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -495,7 +496,7 @@
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.
+
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/partner_identification/tests/test_res_partner.py b/partner_identification/tests/test_res_partner.py
index 8e74eda8fcae..c7d43f8cb066 100644
--- a/partner_identification/tests/test_res_partner.py
+++ b/partner_identification/tests/test_res_partner.py
@@ -7,7 +7,7 @@
from .fake_models import ResPartner, setup_test_model, teardown_test_model
-class TestResPartner(common.SavepointCase):
+class TestResPartner(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
diff --git a/partner_identification/views/res_partner_id_category_view.xml b/partner_identification/views/res_partner_id_category_view.xml
index 78952e71c511..7f256f3b9559 100644
--- a/partner_identification/views/res_partner_id_category_view.xml
+++ b/partner_identification/views/res_partner_id_category_view.xml
@@ -47,7 +47,7 @@ failed = not id_number.name.startswith(self.code) and True or False
res.partner.id_category
tree
-
+
diff --git a/partner_identification/views/res_partner_id_number_view.xml b/partner_identification/views/res_partner_id_number_view.xml
index 2341e9b0db18..e2b558197582 100644
--- a/partner_identification/views/res_partner_id_number_view.xml
+++ b/partner_identification/views/res_partner_id_number_view.xml
@@ -27,7 +27,7 @@
res.partner.id_number
tree
-
+