-
Company type
+
Company type
-
+
-
+
diff --git a/l10n_be_cooperator/README.rst b/l10n_be_cooperator/README.rst
index e48c3fb9f..1cee6b571 100644
--- a/l10n_be_cooperator/README.rst
+++ b/l10n_be_cooperator/README.rst
@@ -1,3 +1,7 @@
+.. image:: https://odoo-community.org/readme-banner-image
+ :target: https://odoo-community.org/get-involved?utm_source=readme
+ :alt: Odoo Community Association
+
===================
Cooperators Belgium
===================
@@ -13,7 +17,7 @@ Cooperators Belgium
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
-.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
+.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcooperative-lightgray.png?logo=github
diff --git a/l10n_be_cooperator/__manifest__.py b/l10n_be_cooperator/__manifest__.py
index 5849ed8b8..374579586 100644
--- a/l10n_be_cooperator/__manifest__.py
+++ b/l10n_be_cooperator/__manifest__.py
@@ -10,11 +10,12 @@
{
"name": "Cooperators Belgium",
"summary": "Cooperators Belgium Localization",
- "version": "16.0.1.2.1",
+ "version": "16.0.2.0.0",
"depends": [
"cooperator",
"cooperator_website",
"l10n_be",
+ "l10n_be_partner_company_type",
],
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
"category": "Cooperative management",
diff --git a/l10n_be_cooperator/migrations/16.0.2.0.0/post-legal_form.py b/l10n_be_cooperator/migrations/16.0.2.0.0/post-legal_form.py
new file mode 100644
index 000000000..f74a7382c
--- /dev/null
+++ b/l10n_be_cooperator/migrations/16.0.2.0.0/post-legal_form.py
@@ -0,0 +1,37 @@
+# SPDX-FileCopyrightText: 2025 Coop IT Easy SC
+#
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+
+def migrate(cr, version):
+ # Copy the company_type from the deprecated legal_form field and
+ # use them to give the same company types from the partner_company_type
+ # module. We're using the fact that the values of the legal_form selection
+ # field are the same as the xml ids of the records in l10n_be_partner_company_type.
+ # Make sure all the legal_forms have a corresponding id in the records.
+ cr.execute(
+ """
+ UPDATE res_partner AS rp
+ SET partner_company_type_id = imd.res_id
+ FROM ir_model_data AS imd
+ WHERE
+ rp.legal_form_deprecated IS NOT NULL
+ AND imd.model = 'res.partner.company.type'
+ AND imd.module = 'l10n_be_partner_company_type'
+ AND imd.name = rp.legal_form_deprecated
+ """
+ )
+
+ # Same Operation for subscription_request
+ cr.execute(
+ """
+ UPDATE subscription_request AS sr
+ SET partner_company_type_id = imd.res_id
+ FROM ir_model_data AS imd
+ WHERE
+ sr.company_type_deprecated IS NOT NULL
+ AND imd.model = 'res.partner.company.type'
+ AND imd.module = 'l10n_be_partner_company_type'
+ AND imd.name = sr.company_type_deprecated
+ """
+ )
diff --git a/l10n_be_cooperator/models/__init__.py b/l10n_be_cooperator/models/__init__.py
index 083381db1..ca77105bf 100644
--- a/l10n_be_cooperator/models/__init__.py
+++ b/l10n_be_cooperator/models/__init__.py
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later
-from . import res_partner
-from . import subscription_request
from . import tax_shelter_certificate
from . import tax_shelter_certificate_line
from . import tax_shelter_declaration
diff --git a/l10n_be_cooperator/models/res_partner.py b/l10n_be_cooperator/models/res_partner.py
deleted file mode 100644
index 1d96b185d..000000000
--- a/l10n_be_cooperator/models/res_partner.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# SPDX-FileCopyrightText: 2019 Coop IT Easy SC
-#
-# SPDX-License-Identifier: AGPL-3.0-or-later
-
-from odoo import fields, models
-
-
-def get_company_type_selection():
- # this list comes from
- # https://www.belgium.be/fr/economie/entreprise/creation/types_de_societe
- return [
- ("aisbl", "AISBL"),
- ("asbl", "ASBL"),
- ("sa", "SA"),
- ("sc", "SC"),
- ("scomm", "SComm"),
- ("snc", "SNC"),
- ("srl", "SRL"),
- # former types (before 2019)
- ("scrl", "SCRL"),
- ("sprl", "SPRL"),
- ]
-
-
-class ResPartner(models.Model):
- _inherit = "res.partner"
-
- legal_form = fields.Selection(selection_add=get_company_type_selection())
diff --git a/l10n_be_cooperator/models/subscription_request.py b/l10n_be_cooperator/models/subscription_request.py
deleted file mode 100644
index 1bdc578aa..000000000
--- a/l10n_be_cooperator/models/subscription_request.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# SPDX-FileCopyrightText: 2019 Coop IT Easy SC
-#
-# SPDX-License-Identifier: AGPL-3.0-or-later
-
-from odoo import fields, models
-
-from . import res_partner
-
-
-class SubscriptionRequest(models.Model):
- _inherit = "subscription.request"
-
- company_type = fields.Selection(
- selection_add=res_partner.get_company_type_selection()
- )
diff --git a/l10n_be_cooperator/readme/newsfragments/167.feature.rst b/l10n_be_cooperator/readme/newsfragments/167.feature.rst
new file mode 100644
index 000000000..c0020e5e4
--- /dev/null
+++ b/l10n_be_cooperator/readme/newsfragments/167.feature.rst
@@ -0,0 +1 @@
+Use the ``partner_company_type`` module to define company types instead of using a custom selection field.
diff --git a/l10n_be_cooperator/static/description/index.html b/l10n_be_cooperator/static/description/index.html
index 17c001fda..517578200 100644
--- a/l10n_be_cooperator/static/description/index.html
+++ b/l10n_be_cooperator/static/description/index.html
@@ -3,15 +3,16 @@
-
Cooperators Belgium
+
README.rst
-
-
Cooperators Belgium
+
+
+
+
+
+
+
Cooperators Belgium
-
+
This is the Belgian localization for the Cooperators module.
Features:
@@ -397,7 +403,7 @@ Cooperators Belgium
-
+
Tax shelter :
According to
this
@@ -417,16 +423,16 @@
wait before adding this information in the report.
-
+
-
+
Features
Move classes to separate files and rename some files to improve consistency. (#89 )
@@ -444,7 +450,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
@@ -452,23 +458,25 @@
Do not contact contributors directly about support or help with technical issues.
-
+
-
+
This module is maintained by the OCA.
-
+
+
+
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.
@@ -477,5 +485,6 @@
+