Skip to content

Commit 21e5541

Browse files
committed
[ADD] l10n_ch_merge_states: New module
1 parent ccf0b88 commit 21e5541

18 files changed

+1065
-0
lines changed

l10n_ch_merge_states/README.rst

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
========================
2+
Switzerland Merge States
3+
========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:6a2e0276d7241eddeba5dc19d6f11286425a866e4031b0a614dc66aa50f4c0d7
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
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-OCA%2Fl10n--switzerland-lightgray.png?logo=github
20+
:target: https://github.com/OCA/l10n-switzerland/tree/18.0/l10n_ch_merge_states
21+
:alt: OCA/l10n-switzerland
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/l10n-switzerland-18-0/l10n-switzerland-18-0-l10n_ch_merge_states
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-switzerland&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Since Odoo 16.0 states are no longer translatable. Odoo's solution was
32+
to create additional states to cover the 3 main switzerland languages
33+
for each state.
34+
35+
This module aims to go back to how it was while mitigating the loss of
36+
state translation feature. It does it by adding archiving feature to the
37+
state model and by allowing the erp manager to choose between four
38+
options (each time archiving the other states).
39+
40+
- Keep only states in german.
41+
- Keep only states in italian.
42+
- Keep only states in french.
43+
- Use the main regional language for each state e.g. Genève for GE and
44+
Graubunden for GR.
45+
46+
The discarded states are archived and the wizard will reassign every
47+
related Many2one and Many2many fields to the chosen state so that logic
48+
relying on states is not lost (e.g. fiscal positions, Geonames Zips,
49+
Public holidays (OCA) ...)
50+
51+
This module will not work for manually created states or if the states
52+
external IDs have been messed with. It is *strongly* encourged to try
53+
the wizard on a test database before running it in production.
54+
55+
**Table of contents**
56+
57+
.. contents::
58+
:local:
59+
60+
Usage
61+
=====
62+
63+
Use the wizard in Settings -> Technical -> Switzerland Merge States
64+
65+
Bug Tracker
66+
===========
67+
68+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-switzerland/issues>`_.
69+
In case of trouble, please check there if your issue has already been reported.
70+
If you spotted it first, help us to smash it by providing a detailed and welcomed
71+
`feedback <https://github.com/OCA/l10n-switzerland/issues/new?body=module:%20l10n_ch_merge_states%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
72+
73+
Do not contact contributors directly about support or help with technical issues.
74+
75+
Credits
76+
=======
77+
78+
Maintainers
79+
-----------
80+
81+
This module is maintained by the OCA.
82+
83+
.. image:: https://odoo-community.org/logo.png
84+
:alt: Odoo Community Association
85+
:target: https://odoo-community.org
86+
87+
OCA, or the Odoo Community Association, is a nonprofit organization whose
88+
mission is to support the collaborative development of Odoo features and
89+
promote its widespread use.
90+
91+
.. |maintainer-jguenat| image:: https://github.com/jguenat.png?size=40px
92+
:target: https://github.com/jguenat
93+
:alt: jguenat
94+
95+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
96+
97+
|maintainer-jguenat|
98+
99+
This module is part of the `OCA/l10n-switzerland <https://github.com/OCA/l10n-switzerland/tree/18.0/l10n_ch_merge_states>`_ project on GitHub.
100+
101+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_ch_merge_states/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from . import wizard

l10n_ch_merge_states/__manifest__.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2019 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
3+
4+
{
5+
"name": "Switzerland Merge States",
6+
"category": "Tools",
7+
"version": "18.0.1.0.0",
8+
"author": "Odoo Community Association (OCA)",
9+
"maintainers": ["jguenat"],
10+
"website": "https://github.com/OCA/l10n-switzerland",
11+
"license": "AGPL-3",
12+
"depends": ["base"],
13+
"external_dependencies": {
14+
"python": [
15+
"openupgradelib",
16+
]
17+
},
18+
"data": [
19+
"wizard/switzerland_merge_states.xml",
20+
"security/ir.model.access.csv",
21+
],
22+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import res_country_state
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
3+
from odoo import fields, models
4+
5+
6+
class ResCountryState(models.Model):
7+
_inherit = "res.country.state"
8+
9+
active = fields.Boolean(default=True)

l10n_ch_merge_states/pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Since Odoo 16.0 states are no longer translatable. Odoo's solution was to
2+
create additional states to cover the 3 main switzerland languages
3+
for each state.
4+
5+
This module aims to go back to how it was while mitigating the loss of
6+
state translation feature. It does it by adding archiving feature to the
7+
state model and by allowing the erp manager to choose between four options
8+
(each time archiving the other states).
9+
10+
- Keep only states in german.
11+
- Keep only states in italian.
12+
- Keep only states in french.
13+
- Use the main regional language for each state e.g. Genève for GE and
14+
Graubunden for GR.
15+
16+
The discarded states are archived and the wizard will reassign every related
17+
Many2one and Many2many fields to the chosen state so that logic relying on states is
18+
not lost (e.g. fiscal positions, Geonames Zips, Public holidays (OCA) ...)
19+
20+
This module will not work for manually created states or if the states external
21+
IDs have been messed with. It is *strongly* encourged to try the wizard on a test
22+
database before running it in production.

l10n_ch_merge_states/readme/USAGE.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use the wizard in Settings -> Technical -> Switzerland Merge States
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
access_switzerland_merge_states,access_switzerland_merge_states,model_switzerland_merge_states,base.group_erp_manager,1,1,1,1
9.23 KB
Loading

0 commit comments

Comments
 (0)