From 408a1543a85def60fb96ebd05e0a5b458cb901bd Mon Sep 17 00:00:00 2001
From: Nguyen Minh Chien
Date: Wed, 9 Oct 2024 17:44:32 +0700
Subject: [PATCH] [MIG] sale_partner_company_group: Migration to 18.0
---
sale_partner_company_group/README.rst | 16 +++++++++++-----
sale_partner_company_group/__manifest__.py | 2 +-
sale_partner_company_group/models/res_partner.py | 12 ++++++------
sale_partner_company_group/readme/CREDITS.md | 1 +
.../static/description/index.html | 16 +++++++++++-----
.../tests/test_sale_partner_company_group.py | 10 ----------
6 files changed, 30 insertions(+), 27 deletions(-)
create mode 100644 sale_partner_company_group/readme/CREDITS.md
diff --git a/sale_partner_company_group/README.rst b/sale_partner_company_group/README.rst
index ac0706a931e..a8e890f9bf1 100644
--- a/sale_partner_company_group/README.rst
+++ b/sale_partner_company_group/README.rst
@@ -17,13 +17,13 @@ Sale Partner Company Group
: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/17.0/sale_partner_company_group
+ :target: https://github.com/OCA/partner-contact/tree/18.0/sale_partner_company_group
: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-17-0/partner-contact-17-0-sale_partner_company_group
+ :target: https://translation.odoo-community.org/projects/partner-contact-18-0/partner-contact-18-0-sale_partner_company_group
: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=17.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/partner-contact&target_branch=18.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -42,7 +42,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 to smash it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -65,6 +65,12 @@ Contributors
- Tharathip Chaweewongphan
+Other credits
+-------------
+
+The migration of this module from 17.0 to 18.0 was financially supported
+by Camptocamp.
+
Maintainers
-----------
@@ -78,6 +84,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/sale_partner_company_group/__manifest__.py b/sale_partner_company_group/__manifest__.py
index 297988d368d..bb9e83e30bf 100644
--- a/sale_partner_company_group/__manifest__.py
+++ b/sale_partner_company_group/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Sale Partner Company Group",
"summary": "Adds the possibility to add a company group to a company",
- "version": "17.0.1.0.0",
+ "version": "18.0.1.0.0",
"category": "Sales",
"author": "Camptocamp SA, Odoo Community Association (OCA)",
"license": "AGPL-3",
diff --git a/sale_partner_company_group/models/res_partner.py b/sale_partner_company_group/models/res_partner.py
index 7ee5d744083..d58dcd38c7b 100644
--- a/sale_partner_company_group/models/res_partner.py
+++ b/sale_partner_company_group/models/res_partner.py
@@ -1,7 +1,7 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from odoo import _, api, models
+from odoo import api, models
class Contact(models.Model):
@@ -17,8 +17,8 @@ def _onchange_company_group_id(self):
):
price_list = self.company_group_id.property_product_pricelist
res["warning"] = {
- "title": _("Warning"),
- "message": _(
+ "title": self.env._("Warning"),
+ "message": self.env._(
"The company group %(company_group)s has"
" the pricelist %(pricelist)s, that is different"
" than the pricelist set on this contact"
@@ -49,10 +49,10 @@ def _onchange_property_product_pricelist(self):
)
members_str = ""
for member in company_members.sorted(key="display_name"):
- members_str += "\t- %s\n" % member.display_name
+ members_str += f"\t- {member.display_name}\n"
res["warning"] = {
- "title": _("Warning"),
- "message": _(
+ "title": self.env._("Warning"),
+ "message": self.env._(
"This contact has members of a company group with"
f" different pricelists, the members are:\n{members_str}"
),
diff --git a/sale_partner_company_group/readme/CREDITS.md b/sale_partner_company_group/readme/CREDITS.md
new file mode 100644
index 00000000000..83b3ec91f7d
--- /dev/null
+++ b/sale_partner_company_group/readme/CREDITS.md
@@ -0,0 +1 @@
+The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp.
diff --git a/sale_partner_company_group/static/description/index.html b/sale_partner_company_group/static/description/index.html
index d4982e47957..e1d3a9f83f0 100644
--- a/sale_partner_company_group/static/description/index.html
+++ b/sale_partner_company_group/static/description/index.html
@@ -369,7 +369,7 @@ Sale Partner Company Group
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5f970360a2188033416bb23525b938c4bf9aadc58485578ea86c6bddbf72cdc3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This Module adds a company group field to sale orders. For more details
investigate in base_partner_company_group.
Table of contents
@@ -379,7 +379,8 @@ Sale Partner Company Group
Credits
@@ -389,7 +390,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 to smash it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
+
+
+
The migration of this module from 17.0 to 18.0 was financially supported
+by Camptocamp.
+
diff --git a/sale_partner_company_group/tests/test_sale_partner_company_group.py b/sale_partner_company_group/tests/test_sale_partner_company_group.py
index 21786bf0660..ea9d91f00ce 100644
--- a/sale_partner_company_group/tests/test_sale_partner_company_group.py
+++ b/sale_partner_company_group/tests/test_sale_partner_company_group.py
@@ -10,16 +10,6 @@ class TestSalePartnerCompanyGroup(TestBasePartnerCompanyGroup):
@classmethod
def setUpClass(cls):
super().setUpClass()
- # Remove this variable in v16 and put instead:
- # from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
- DISABLED_MAIL_CONTEXT = {
- "tracking_disable": True,
- "mail_create_nolog": True,
- "mail_create_nosubscribe": True,
- "mail_notrack": True,
- "no_reset_password": True,
- }
- cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
currency = cls.env.ref("base.USD")
cls.pricelist1 = cls.env["product.pricelist"].create(
{"name": "Pricelist 01", "currency_id": currency.id}