Merge lp:~akretion-team/openerp-french-localization/add-l10n_fr_base_location_geonames_import into lp:openerp-french-localization/7.0

Proposed by Alexis de Lattre
Status: Merged
Merged at revision: 6
Proposed branch: lp:~akretion-team/openerp-french-localization/add-l10n_fr_base_location_geonames_import
Merge into: lp:openerp-french-localization/7.0
Diff against target: 212 lines (+191/-0)
4 files modified
l10n_fr_base_location_geonames_import/__init__.py (+23/-0)
l10n_fr_base_location_geonames_import/__openerp__.py (+44/-0)
l10n_fr_base_location_geonames_import/wizard/__init__.py (+23/-0)
l10n_fr_base_location_geonames_import/wizard/geonames_import.py (+101/-0)
To merge this branch: bzr merge lp:~akretion-team/openerp-french-localization/add-l10n_fr_base_location_geonames_import
Reviewer Review Type Date Requested Status
OpenERP FR Core Editors Pending
Review via email: mp+221749@code.launchpad.net

Description of the change

Add module l10n_fr_base_location_geonames_import. Extract from module description :

This module adds some France-specific tuning for the wizard that imports better zip entries from Geonames (http://download.geonames.org/export/zip/). This wizard is provided by the module base_location_geonames_import from lp:partner-contact-management (MP https://code.launchpad.net/~akretion-team/partner-contact-management/base-location-geonames-import/+merge/214564). This tuning aims at complying with France's postal standards published by La Poste.

To post a comment you must log in.
6. By Alexis de Lattre

Add France-related territories where La Postale standards apply.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'l10n_fr_base_location_geonames_import'
2=== added file 'l10n_fr_base_location_geonames_import/__init__.py'
3--- l10n_fr_base_location_geonames_import/__init__.py 1970-01-01 00:00:00 +0000
4+++ l10n_fr_base_location_geonames_import/__init__.py 2014-06-11 07:40:31 +0000
5@@ -0,0 +1,23 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# l10n FR Base Location Geonames Import module for OpenERP
10+# Copyright (C) 2014 Akretion (http://www.akretion.com)
11+# @author Alexis de Lattre <alexis.delattre@akretion.com>
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+from . import wizard
29
30=== added file 'l10n_fr_base_location_geonames_import/__openerp__.py'
31--- l10n_fr_base_location_geonames_import/__openerp__.py 1970-01-01 00:00:00 +0000
32+++ l10n_fr_base_location_geonames_import/__openerp__.py 2014-06-11 07:40:31 +0000
33@@ -0,0 +1,44 @@
34+# -*- encoding: utf-8 -*-
35+##############################################################################
36+#
37+# l10n FR Base Location Geonames Import module for OpenERP
38+# Copyright (C) 2014 Akretion (http://www.akretion.com)
39+# @author Alexis de Lattre <alexis.delattre@akretion.com>
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as
43+# published by the Free Software Foundation, either version 3 of the
44+# License, or (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+
56+
57+{
58+ 'name': 'French Localization for Base Location Geonames Import',
59+ 'version': '0.1',
60+ 'category': 'Extra Tools',
61+ 'license': 'AGPL-3',
62+ 'summary': 'France-specific tuning for import of better zip entries from Geonames',
63+ 'description': """
64+French Localization Base Location Geonames Import
65+=================================================
66+
67+This module adds some France-specific tuning for the wizard that imports better zip entries from Geonames (http://download.geonames.org/export/zip/). This wizard is provided by the module base_location_geonames_import from the projet *partner-contact-management*. This tuning aims at complying with France's postal standards published by *La Poste*. This tuning will be applied for France and France-related territories where *La Poste* postal standards apply.
68+
69+Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
70+ """,
71+ 'author': 'Akretion',
72+ 'website': 'http://www.akretion.com',
73+ 'depends': ['base_location_geonames_import'],
74+ 'external_dependencies': {'python': ['unicodecsv']},
75+ 'data': [],
76+ 'installable': True,
77+}
78
79=== added directory 'l10n_fr_base_location_geonames_import/wizard'
80=== added file 'l10n_fr_base_location_geonames_import/wizard/__init__.py'
81--- l10n_fr_base_location_geonames_import/wizard/__init__.py 1970-01-01 00:00:00 +0000
82+++ l10n_fr_base_location_geonames_import/wizard/__init__.py 2014-06-11 07:40:31 +0000
83@@ -0,0 +1,23 @@
84+# -*- encoding: utf-8 -*-
85+##############################################################################
86+#
87+# l10n FR Base Location Geonames Import module for OpenERP
88+# Copyright (C) 2014 Akretion (http://www.akretion.com)
89+# @author Alexis de Lattre <alexis.delattre@akretion.com>
90+#
91+# This program is free software: you can redistribute it and/or modify
92+# it under the terms of the GNU Affero General Public License as
93+# published by the Free Software Foundation, either version 3 of the
94+# License, or (at your option) any later version.
95+#
96+# This program is distributed in the hope that it will be useful,
97+# but WITHOUT ANY WARRANTY; without even the implied warranty of
98+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
99+# GNU Affero General Public License for more details.
100+#
101+# You should have received a copy of the GNU Affero General Public License
102+# along with this program. If not, see <http://www.gnu.org/licenses/>.
103+#
104+##############################################################################
105+
106+from . import geonames_import
107
108=== added file 'l10n_fr_base_location_geonames_import/wizard/geonames_import.py'
109--- l10n_fr_base_location_geonames_import/wizard/geonames_import.py 1970-01-01 00:00:00 +0000
110+++ l10n_fr_base_location_geonames_import/wizard/geonames_import.py 2014-06-11 07:40:31 +0000
111@@ -0,0 +1,101 @@
112+# -*- encoding: utf-8 -*-
113+##############################################################################
114+#
115+# l10n FR Base Location Geonames Import module for OpenERP
116+# Copyright (C) 2014 Akretion (http://www.akretion.com/)
117+# @author: Alexis de Lattre <alexis.delattre@akretion.com>
118+#
119+# This program is free software: you can redistribute it and/or modify
120+# it under the terms of the GNU Affero General Public License as
121+# published by the Free Software Foundation, either version 3 of the
122+# License, or (at your option) any later version.
123+#
124+# This program is distributed in the hope that it will be useful,
125+# but WITHOUT ANY WARRANTY; without even the implied warranty of
126+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
127+# GNU Affero General Public License for more details.
128+#
129+# You should have received a copy of the GNU Affero General Public License
130+# along with this program. If not, see <http://www.gnu.org/licenses/>.
131+#
132+##############################################################################
133+
134+from openerp.osv import orm
135+from unidecode import unidecode
136+
137+
138+class better_zip_geonames_import(orm.TransientModel):
139+ _inherit = 'better.zip.geonames.import'
140+
141+ def _prepare_better_zip(
142+ self, cr, uid, row, country_id, states, context=None):
143+ res = super(better_zip_geonames_import, self)._prepare_better_zip(
144+ cr, uid, row, country_id, states, context=context)
145+ if row[0] in [
146+ 'FR', 'RE', 'GP', 'MQ', 'GF', 'YT', 'BL', 'MF', 'PM',
147+ 'PF', 'NC', 'WF', 'MC', 'AD']:
148+ # Modify city and zip to comply with French postal standards
149+ res['city'] = unidecode(res['city']).upper().replace('-', ' ')
150+ # Try to comply with the standard that says res['city'] name is
151+ # 32 chars max
152+ if len(res['city']) > 32 and res['city'].startswith('SAINTE '):
153+ res['city'] = u'STE %s' % res['city'][7:]
154+ if len(res['city']) > 32 and res['city'].startswith('SAINT '):
155+ res['city'] = u'ST %s' % res['city'][6:]
156+ # Move CEDEX from zip to city field
157+ zipori = res['name']
158+ if ' CEDEX' in res['name']:
159+ position = res['name'].rfind(' CEDEX')
160+ res['name'] = res['name'][0:position]
161+ res['city'] = u'%s%s' % (res['city'], zipori[position:])
162+ rewrite_city_by_zip = {
163+ # Do not put the number of the arrondissement in the city name
164+ '69001': 'LYON',
165+ '69002': 'LYON',
166+ '69003': 'LYON',
167+ '69004': 'LYON',
168+ '69005': 'LYON',
169+ '69006': 'LYON',
170+ '69007': 'LYON',
171+ '69008': 'LYON',
172+ '69009': 'LYON',
173+ '13001': 'MARSEILLE',
174+ '13002': 'MARSEILLE',
175+ '13003': 'MARSEILLE',
176+ '13004': 'MARSEILLE',
177+ '13005': 'MARSEILLE',
178+ '13006': 'MARSEILLE',
179+ '13007': 'MARSEILLE',
180+ '13008': 'MARSEILLE',
181+ '13009': 'MARSEILLE',
182+ '13010': 'MARSEILLE',
183+ '13011': 'MARSEILLE',
184+ '13012': 'MARSEILLE',
185+ '13013': 'MARSEILLE',
186+ '13014': 'MARSEILLE',
187+ '13015': 'MARSEILLE',
188+ '13016': 'MARSEILLE',
189+ '75001': 'PARIS',
190+ '75002': 'PARIS',
191+ '75003': 'PARIS',
192+ '75004': 'PARIS',
193+ '75005': 'PARIS',
194+ '75006': 'PARIS',
195+ '75007': 'PARIS',
196+ '75008': 'PARIS',
197+ '75009': 'PARIS',
198+ '75010': 'PARIS',
199+ '75011': 'PARIS',
200+ '75012': 'PARIS',
201+ '75013': 'PARIS',
202+ '75014': 'PARIS',
203+ '75015': 'PARIS',
204+ '75016': 'PARIS',
205+ '75017': 'PARIS',
206+ '75018': 'PARIS',
207+ '75019': 'PARIS',
208+ '75020': 'PARIS',
209+ }
210+ if res['name'] in rewrite_city_by_zip:
211+ res['city'] = rewrite_city_by_zip[res['name']]
212+ return res

Subscribers

People subscribed via source and target branches