Browse Source

[MIG] base_location_geonames_import: Initial migration to 9.0

pull/253/head
Pedro M. Baeza 9 years ago
parent
commit
a2179a835f
  1. 22
      base_location_geonames_import/README.rst
  2. 23
      base_location_geonames_import/__init__.py
  3. 36
      base_location_geonames_import/__openerp__.py
  4. 68
      base_location_geonames_import/i18n/base_location_geonames_import.pot
  5. 23
      base_location_geonames_import/wizard/__init__.py
  6. 33
      base_location_geonames_import/wizard/geonames_import.py

22
base_location_geonames_import/README.rst

@ -1,3 +1,8 @@
.. 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
=============================
Base Location Geonames Import
=============================
@ -29,6 +34,23 @@ selected country, it will delete all the current better zip entries, download
the latest version of the list of cities from geonames.org and create new
better zip entries.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/9.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
partner-contact/issues/new?body=module:%20
base_location_geonames_import%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======

23
base_location_geonames_import/__init__.py

@ -1,23 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Base Location Geonames Import module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import wizard

36
base_location_geonames_import/__openerp__.py

@ -1,32 +1,13 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Base Location Geonames Import module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright (C) 2014 Agile Business Group (http://www.agilebg.com)
# @author Lorenzo Battistini <lorenzo.battistini@agilebg.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2014 Alexis de Lattre <alexis.delattre@akretion.com>
# © 2014 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Base Location Geonames Import',
'version': '8.0.0.3.0',
'category': 'Extra Tools',
'version': '9.0.1.0.0',
'category': 'Partner Management',
'license': 'AGPL-3',
'summary': 'Import better zip entries from Geonames',
'author': 'Akretion,'
@ -42,7 +23,6 @@
],
'test': [
'test/import.yml'
],
'installable': False,
'active': False,
],
'installable': True,
}

68
base_location_geonames_import/i18n/base_location_geonames_import.pot

@ -1,68 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * base_location_geonames_import
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-11 20:55+0000\n"
"PO-Revision-Date: 2014-04-11 20:55+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: base_location_geonames_import
#: view:better.zip.geonames.import:0
msgid "Cancel"
msgstr ""
#. module: base_location_geonames_import
#: field:better.zip.geonames.import,country_id:0
msgid "Country"
msgstr ""
#. module: base_location_geonames_import
#: code:addons/base_location_geonames_import/wizard/geonames_import.py:66
#: code:addons/base_location_geonames_import/wizard/geonames_import.py:90
#, python-format
msgid "Error:"
msgstr ""
#. module: base_location_geonames_import
#: view:better.zip.geonames.import:0
msgid "For the country selected above, this wizard will download the latest version of the list of cities from geonames.org, create new location entries if not found already in the system, and DELETE MISSING ENTRIES from new file."
msgstr ""
#. module: base_location_geonames_import
#: code:addons/base_location_geonames_import/wizard/geonames_import.py:91
#, python-format
msgid "Got an error %d when trying to download the file %s."
msgstr ""
#. module: base_location_geonames_import
#: view:better.zip.geonames.import:0
msgid "Import"
msgstr ""
#. module: base_location_geonames_import
#: model:ir.model,name:base_location_geonames_import.model_better_zip_geonames_import
msgid "Import Better Zip from Geonames"
msgstr ""
#. module: base_location_geonames_import
#: view:better.zip.geonames.import:0
#: model:ir.actions.act_window,name:base_location_geonames_import.better_zip_geonames_import_action
#: model:ir.ui.menu,name:base_location_geonames_import.better_zip_geonames_import_menu
msgid "Import from Geonames"
msgstr ""
#. module: base_location_geonames_import
#: code:addons/base_location_geonames_import/wizard/geonames_import.py:67
#, python-format
msgid "The country code inside the file (%s) doesn't correspond to the selected country (%s)."
msgstr ""

23
base_location_geonames_import/wizard/__init__.py

@ -1,23 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Base Location Geonames Import module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import geonames_import

33
base_location_geonames_import/wizard/geonames_import.py

@ -1,29 +1,10 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Base Location Geonames Import module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright (C) 2014 Agile Business Group (http://www.agilebg.com)
# @author Lorenzo Battistini <lorenzo.battistini@agilebg.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2014 Alexis de Lattre <alexis.delattre@akretion.com>
# © 2014 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
from openerp.exceptions import Warning
from openerp.exceptions import Warning as UserError
import requests
import tempfile
import StringIO
@ -79,7 +60,7 @@ class BetterZipGeonamesImport(models.TransientModel):
@api.model
def create_better_zip(self, row, country):
if row[0] != country.code:
raise Warning(
raise UserError(
_("The country code inside the file (%s) doesn't "
"correspond to the selected country (%s).")
% (row[0], country.code))
@ -108,7 +89,7 @@ class BetterZipGeonamesImport(models.TransientModel):
('code', '=', row[code_row_index]),
])
if len(states) > 1:
raise Warning(
raise UserError(
_("Too many states with code %s for country %s")
% (row[code_row_index], country.code))
if len(states) == 1:
@ -131,7 +112,7 @@ class BetterZipGeonamesImport(models.TransientModel):
logger.info('Starting to download %s' % url)
res_request = requests.get(url)
if res_request.status_code != requests.codes.ok:
raise Warning(
raise UserError(
_('Got an error %d when trying to download the file %s.')
% (res_request.status_code, url))
# Store current record list

Loading…
Cancel
Save