Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] l10n_fr_department_oversea #588

Merged
merged 35 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d25e30b
Add module l10n_fr_department_oversea
alexis-via Jul 25, 2016
299737a
Remove debug print
alexis-via Jul 25, 2016
75a43a8
PEP8 fix
alexis-via Jul 25, 2016
d71ba83
Make modules uninstallable
pedrobaeza Oct 6, 2016
03ebae6
Rename manifest files
pedrobaeza Oct 6, 2016
98779b8
Port l10n_fr_department, l10n_fr_department_oversea and l10n_fr_state…
alexis-via Oct 6, 2016
cb7ca27
l10n_fr_department_oversea: migrate to 11.0
Apr 23, 2018
db90702
Update l10n_fr_department_oversea.pot
oca-travis Jun 23, 2018
d89e44e
[MIG] l10n_fr_department, l10n_fr_department_oversea, l10n_fr_state f…
alexis-via Oct 5, 2018
475c645
l10n_fr_department_oversea: update version number to v12
alexis-via Oct 22, 2018
726c741
[UPD] README.rst
OCA-git-bot Nov 7, 2018
a7fda69
[UPD] Update l10n_fr_department_oversea.pot
oca-travis Nov 7, 2018
212ad8b
[ADD] icon.png
OCA-git-bot Apr 3, 2019
a1e03d8
[UPD] README.rst
OCA-git-bot Jul 29, 2019
61bab42
[MIG] l10n_fr_department_oversea: migration 12.0 to 13.0
zuher83 Feb 15, 2020
b49a129
[UPD] README.rst
OCA-git-bot Jun 7, 2020
ab938ad
[MIG] l10n_fr_department* and l10n_fr_state to v14
alexis-via Oct 9, 2020
c7e1185
[UPD] README.rst
OCA-git-bot Oct 15, 2020
f34e274
[UPD] Update l10n_fr_department_oversea.pot
oca-travis Aug 10, 2021
ac2c5ef
Restore tests and remove Alpha status
alexis-via Sep 1, 2021
bf8b99c
[UPD] README.rst
OCA-git-bot Sep 2, 2021
f01b3ec
l10n_fr_department_oversea 14.0.1.0.1
OCA-git-bot Sep 2, 2021
632bbea
[MIG] l10n_fr_department and l10n_fr_department_oversea from v14 to v15
alexis-via Jan 2, 2022
32585a9
[UPD] Update l10n_fr_department_oversea.pot
Jan 28, 2022
b3396e0
[UPD] README.rst
OCA-git-bot Jan 28, 2022
a5a7601
[MIG] l10n_fr_department and l10n_fr_department_oversea to v16
alexis-via Dec 26, 2022
78dc708
[UPD] Update l10n_fr_department_oversea.pot
Dec 30, 2022
e631994
[UPD] README.rst
OCA-git-bot Dec 30, 2022
fe2b120
[UPD] README.rst
OCA-git-bot Sep 3, 2023
b69c326
l10n_fr_state + l10n_fr_department*: pre-commit auto fixes
alexis-via Dec 29, 2023
42ca02e
[MIG] l10n_fr_state and l10n_fr_department* to v17
alexis-via Dec 29, 2023
b35e0b7
[UPD] Update l10n_fr_department_oversea.pot
Jan 19, 2024
99e0092
[BOT] post-merge updates
OCA-git-bot Jan 19, 2024
852e2c4
[IMP] l10n_fr_department_oversea: pre-commit auto fixes
alexis-via Nov 26, 2024
aaa679c
[IMP] l10n_fr_department_oversea: improve variable name
alexis-via Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions l10n_fr_department_oversea/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
=================================
French Overseas Departments (DOM)
=================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ae81c78cfac8c58cff9a7f2a3acfd06b1a70bf0ba004bae5232000c95fc76e12
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--france-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-france/tree/18.0/l10n_fr_department_oversea
:alt: OCA/l10n-france
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-france-18-0/l10n-france-18-0-l10n_fr_department_oversea
: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/l10n-france&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds the 5 French overseas States (Régions) and Departments
(Départements) in the *res_country_state* and *res_country_department*
tables.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-france/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 <https://github.com/OCA/l10n-france/issues/new?body=module:%20l10n_fr_department_oversea%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Akretion

Contributors
------------

- Alexis de Lattre <[email protected]>
- Danh Vo <https://github.com/danhvophuong>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-alexis-via| image:: https://github.com/alexis-via.png?size=40px
:target: https://github.com/alexis-via
:alt: alexis-via

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-alexis-via|

This module is part of the `OCA/l10n-france <https://github.com/OCA/l10n-france/tree/18.0/l10n_fr_department_oversea>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions l10n_fr_department_oversea/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .pre_init_hook import create_fr_oversea_state_xmlid
from .post_install import set_oversea_department_on_partner
23 changes: 23 additions & 0 deletions l10n_fr_department_oversea/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2016-2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "French Overseas Departments (DOM)",
"summary": "Populate Database with overseas French "
"Departments (Départements d'outre-mer)",
"version": "18.0.1.0.0",
"category": "French Localization",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/l10n-france",
"license": "AGPL-3",
"depends": ["l10n_fr_department"],
"data": [
"data/res_country_state.xml",
"data/res_country_department.xml",
],
"pre_init_hook": "create_fr_oversea_state_xmlid",
"post_init_hook": "set_oversea_department_on_partner",
"installable": True,
}
32 changes: 32 additions & 0 deletions l10n_fr_department_oversea/data/res_country_department.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
Copyright 2016-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <[email protected]>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="res_country_department_guadeloupe" model="res.country.department">
<field name="name">Guadeloupe</field>
<field name="code">971</field>
<field name="state_id" ref="res_country_state_guadeloupe" />
</record>
<record id="res_country_department_martinique" model="res.country.department">
<field name="name">Martinique</field>
<field name="code">972</field>
<field name="state_id" ref="res_country_state_martinique" />
</record>
<record id="res_country_department_guyane" model="res.country.department">
<field name="name">Guyane</field>
<field name="code">973</field>
<field name="state_id" ref="res_country_state_guyane" />
</record>
<record id="res_country_department_reunion" model="res.country.department">
<field name="name">La Réunion</field>
<field name="code">974</field>
<field name="state_id" ref="res_country_state_reunion" />
</record>
<record id="res_country_department_mayotte" model="res.country.department">
<field name="name">Mayotte</field>
<field name="code">976</field>
<field name="state_id" ref="res_country_state_mayotte" />
</record>
</odoo>
32 changes: 32 additions & 0 deletions l10n_fr_department_oversea/data/res_country_state.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
Copyright 2016-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <[email protected]>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="res_country_state_guadeloupe" model="res.country.state">
<field name="code">GP</field>
<field name="country_id" ref="base.gp" />
<field name="name">Guadeloupe</field>
</record>
<record id="res_country_state_martinique" model="res.country.state">
<field name="code">MQ</field>
<field name="country_id" ref="base.mq" />
<field name="name">Martinique</field>
</record>
<record id="res_country_state_guyane" model="res.country.state">
<field name="code">GF</field>
<field name="country_id" ref="base.gf" />
<field name="name">Guyane</field>
</record>
<record id="res_country_state_reunion" model="res.country.state">
<field name="code">RE</field>
<field name="country_id" ref="base.re" />
<field name="name">La Réunion</field>
</record>
<record id="res_country_state_mayotte" model="res.country.state">
<field name="code">YT</field>
<field name="country_id" ref="base.yt" />
<field name="name">Mayotte</field>
</record>
</odoo>
13 changes: 13 additions & 0 deletions l10n_fr_department_oversea/i18n/l10n_fr_department_oversea.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
26 changes: 26 additions & 0 deletions l10n_fr_department_oversea/post_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2016-2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


def set_oversea_department_on_partner(env):
"""This post_install script is required because, when the module
is installed, Odoo creates the column in the DB and compute the field
and THEN it loads the file data/res_country_department.xml...
So, when it computes the field on module installation, the
departments are not available in the DB, so the country_department_id field
on res.partner stays null. This post_install script fixes this."""
fr_dom_countries = env["res.country"].search(
[("code", "in", ("FR", "GP", "MQ", "GF", "RE", "YT"))]
)
partners = (
env["res.partner"]
.with_context(active_test=False)
.search(
[
("country_id", "in", fr_dom_countries.ids),
("country_department_id", "=", False),
]
)
)
partners._compute_country_department()
20 changes: 20 additions & 0 deletions l10n_fr_department_oversea/pre_init_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2017-2022 Akretion France
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.l10n_fr_state.pre_init_hook import generic_create_state_xmlid

# This code is designed to avoid a problem in the following scenario:
# On a new database, the administrator executes these steps in this order:
# 1) installs base_address_extended_geonames_import and run the geonames import wizard
# for one of the French DOMs
# -> it creates the corresponding French regions (without xmlid)
# 2) installs l10n_fr_department_oversea
# -> it tries to create the res.country.state, but it fails due to the unicity
# constraint unique(country_id, code) of res.country.state.


def create_fr_oversea_state_xmlid(env):
generic_create_state_xmlid(
env, "l10n_fr_department_oversea", "data/res_country_state.xml"
)
3 changes: 3 additions & 0 deletions l10n_fr_department_oversea/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions l10n_fr_department_oversea/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Alexis de Lattre \<<[email protected]>\>
- Danh Vo \<<https://github.com/danhvophuong>\>
3 changes: 3 additions & 0 deletions l10n_fr_department_oversea/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module adds the 5 French overseas States (Régions) and Departments
(Départements) in the *res_country_state* and *res_country_department*
tables.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading