Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f36e4c
commit 71952aa
Showing
13 changed files
with
132,280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=============== | ||
German toponyms | ||
=============== | ||
|
||
Adds the german zipcodes and toponyms | ||
|
||
Installation | ||
============ | ||
|
||
`base_location_geonames_import` from `partner-contact` repository is | ||
needed to download the toponym database. | ||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/175/11.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Florian Kantelberg <florian.kantelberg@initos.com> | ||
* IT IS AG <oca@itis.de> | ||
* Jordi Esteve <jesteve@zikzakmedia.com> | ||
* Pedro M. Baeza <pedro.baeza@tecnativa.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2018 IT IS AG <oca@itis.de> | ||
# Copyright 2018 Florian Kantelberg <florian.kantelberg@initos.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2018 IT IS AG <oca@itis.de> | ||
# Copyright 2018 Florian Kantelberg <florian.kantelberg@initos.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "German Toponyms", | ||
"version": "11.0.1.0.0", | ||
"author": "IT IS AG Germany, " | ||
"initOS GmbH, " | ||
"Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/l10n-germany", | ||
"category": "Localization", | ||
"depends": [ | ||
"base_location_geonames_import", | ||
"l10n_de_country_states", | ||
], | ||
"license": "AGPL-3", | ||
"data": [ | ||
"wizard/l10n_de_toponyms_wizard.xml", | ||
], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_de_toponyms | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-09-05 23:03+0000\n" | ||
"PO-Revision-Date: 2018-09-05 23:03+0000\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" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "Configure from GeoNames" | ||
msgstr "Konfigure mit GeoNames" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "Configure from local" | ||
msgstr "Konfigure mit lokaler Datei" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_create_uid | ||
msgid "Created by" | ||
msgstr "Erstellt von" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_create_date | ||
msgid "Created on" | ||
msgstr "Erstellt am" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_display_name | ||
msgid "Display Name" | ||
msgstr "Anzeigename" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "German cities configuration" | ||
msgstr "Konfiguration der deutschen Städte" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.actions.act_window,name:l10n_de_toponyms.action_config_toponyms_de_form | ||
msgid "German toponyms configuration" | ||
msgstr "Konfiguration der deutschen Ortsbezeichnung" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms___last_update | ||
msgid "Last Modified on" | ||
msgstr "Zuletzt geändert am" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_write_uid | ||
msgid "Last Updated by" | ||
msgstr "Zuletzt aktualisiert durch" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_write_date | ||
msgid "Last Updated on" | ||
msgstr "Zuletzt aktualisiert am" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_name | ||
msgid "Name" | ||
msgstr "Name" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "This wizard will add city and state information to zip codes" | ||
msgstr "Dieser Assistent wird Informationen über Städte und Postleitzahlen hinzufügen." | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "Warning! Adding this bunch of records can take a lot of time. If you are behind a SSL proxy, check your timeout." | ||
msgstr "Achtung! Das Hinzufügen der Daten kann einige Zeit dauern. Falls sie hinter einem SSL Proxy sind, prüfen sie Zeitbeschränkung." | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model,name:l10n_de_toponyms.model_config_de_toponyms | ||
msgid "config.de.toponyms" | ||
msgstr "config.de.toponyms" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_de_toponyms | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-09-05 23:05+0000\n" | ||
"PO-Revision-Date: 2018-09-05 23:05+0000\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" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "Configure from GeoNames" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "Configure from local" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_create_uid | ||
msgid "Created by" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_create_date | ||
msgid "Created on" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "German cities configuration" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.actions.act_window,name:l10n_de_toponyms.action_config_toponyms_de_form | ||
msgid "German toponyms configuration" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms___last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_write_uid | ||
msgid "Last Updated by" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_write_date | ||
msgid "Last Updated on" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model.fields,field_description:l10n_de_toponyms.field_config_de_toponyms_name | ||
msgid "Name" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "This wizard will add city and state information to zip codes" | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.ui.view,arch_db:l10n_de_toponyms.view_confirm_toponyms_de_form | ||
msgid "Warning! Adding this bunch of records can take a lot of time. If you are behind a SSL proxy, check your timeout." | ||
msgstr "" | ||
|
||
#. module: l10n_de_toponyms | ||
#: model:ir.model,name:l10n_de_toponyms.model_config_de_toponyms | ||
msgid "config.de.toponyms" | ||
msgstr "" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2018 IT IS AG <oca@itis.de> | ||
# Copyright 2018 Florian Kantelberg <florian.kantelberg@initos.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import test_l10n_de_toponyms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2013-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com> | ||
# Copyright 2018 Florian Kantelberg <florian.kantelberg@initos.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo.tests import common | ||
|
||
|
||
class TestL10nDeToponyms(common.SavepointCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(TestL10nDeToponyms, cls).setUpClass() | ||
cls.wizard = cls.env['config.de.toponyms'].create({ | ||
'name': '', | ||
}) | ||
|
||
def test_import(self): | ||
self.wizard.with_context(max_import=10).execute() | ||
zips = self.env['res.better.zip'].search([ | ||
('country_id', '=', self.env.ref('base.de').id) | ||
]) | ||
self.assertTrue(zips) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright 2013-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com> | ||
# Copyright 2018 Florian Kantelberg <florian.kantelberg@initos.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
import csv | ||
import requests | ||
import zipfile | ||
from io import BytesIO | ||
|
||
COUNTRY_CODE = "DE" | ||
|
||
|
||
if __name__ == "__main__": | ||
url = "http://download.geonames.org/export/zip/%s.zip" % COUNTRY_CODE | ||
|
||
print('Downloading from %s' % url) | ||
response = requests.get(url) | ||
if response.status_code != requests.codes.ok: | ||
print('Error while downloading: %s.' % response.status_code) | ||
exit(response.status_code) | ||
|
||
print('Decompressing archive...') | ||
zipped = zipfile.ZipFile(BytesIO(response.content), 'r') | ||
data = zipped.read('%s.txt' % COUNTRY_CODE).decode('UTF-8').splitlines() | ||
|
||
dialect = csv.excel | ||
dialect.delimiter = "\t" | ||
reader = csv.reader(data, dialect=dialect) | ||
|
||
print('Generate the XML...') | ||
output = open("l10n_de_toponyms_zipcodes.xml", 'w') | ||
output.write('<?xml version="1.0" encoding="UTF-8"?>\n') | ||
output.write('<odoo noupdate="1">\n') | ||
for k, row in enumerate(reader): | ||
zipcode, city, _, state_code = row[1: 5] | ||
state = "l10n_de_country_states.res_country_state_%s" % state_code | ||
city_id = "city_DE_%s" % k | ||
lat, lon = row[9: 11] | ||
|
||
output.write(''.join([ | ||
' ' * 8 + '<record id="%s" model="res.better.zip">\n' % city_id, | ||
' ' * 12 + '<field name="state_id" ref="%s"/>\n' % state, | ||
' ' * 12 + '<field name="city">%s</field>\n' % city, | ||
' ' * 12 + '<field name="name">%s</field>\n' % zipcode, | ||
' ' * 12 + '<field name="country_id" ref="base.de"/>\n', | ||
' ' * 12 + '<field name="latitude">%s</field>\n' % lat, | ||
' ' * 12 + '<field name="longitude">%s</field>\n' % lon, | ||
' ' * 8 + '</record>\n', | ||
])) | ||
|
||
output.write('</odoo>\n') | ||
output.close() | ||
print("Done.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import l10n_de_toponyms_wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2009 Jordi Esteve <jesteve@zikzakmedia.com> | ||
# Copyright 2013-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com> | ||
# Copyright 2018 IT IS AG <oca@itis.de> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api, tools | ||
import os | ||
|
||
|
||
class ConfigDeToponyms(models.TransientModel): | ||
_name = 'config.de.toponyms' | ||
_inherit = 'res.config.installer' | ||
|
||
name = fields.Char('Name', size=64) | ||
|
||
@api.model | ||
def create_zipcodes(self): | ||
"""Import spanish zipcodes information through an XML file.""" | ||
file_name = 'l10n_de_toponyms_zipcodes.xml' | ||
path = os.path.join('l10n_de_toponyms', 'wizard', file_name) | ||
with tools.file_open(path) as fp: | ||
tools.convert_xml_import(self.env.cr, 'l10n_de_toponyms', fp, {}, | ||
'init', noupdate=True) | ||
return True | ||
|
||
@api.multi | ||
def execute(self): | ||
res = super(ConfigDeToponyms, self).execute() | ||
wizard_obj = self.env['better.zip.geonames.import'] | ||
country_es = self.env['res.country'].search([('code', '=', 'DE')]) | ||
wizard = wizard_obj.create({'country_id': country_es.id}) | ||
wizard.run_import() | ||
return res | ||
|
||
@api.multi | ||
def execute_local(self): # pragma: no cover | ||
self.create_zipcodes() |
Oops, something went wrong.