Browse Source

[MIG] base_location_nuts: Migration to 10.0

pull/518/head
David Vidal 8 years ago
committed by Jairo Llopis
parent
commit
8676d5f8a6
  1. 20
      base_location_nuts/README.rst
  2. 3
      base_location_nuts/__init__.py
  3. 35
      base_location_nuts/__manifest__.py
  4. 213
      base_location_nuts/i18n/de.po
  5. 2
      base_location_nuts/i18n/es.po
  6. 212
      base_location_nuts/i18n/fi.po
  7. 237
      base_location_nuts/i18n/it.po
  8. 213
      base_location_nuts/i18n/sl.po
  9. 11
      base_location_nuts/models/__init__.py
  10. 8
      base_location_nuts/models/res_country.py
  11. 58
      base_location_nuts/models/res_partner.py
  12. 29
      base_location_nuts/models/res_partner_nuts.py
  13. 3
      base_location_nuts/tests/__init__.py
  14. 90
      base_location_nuts/tests/test_base_location_nuts.py
  15. 10
      base_location_nuts/views/res_country_view.xml
  16. 11
      base_location_nuts/views/res_partner_nuts_view.xml
  17. 11
      base_location_nuts/views/res_partner_view.xml
  18. 3
      base_location_nuts/wizard/__init__.py
  19. 46
      base_location_nuts/wizard/nuts_import.py
  20. 11
      base_location_nuts/wizard/nuts_import_view.xml

20
base_location_nuts/README.rst

@ -48,16 +48,15 @@ in order to allow to assign them to partner object.
.. 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/8.0
:target: https://runbot.odoo-community.org/runbot/134/10.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
`here <https://github.com/OCA/partner-contact/issues/new?body=module:%20base_location_nuts%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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 smash it by providing detailed and welcomed feedback.
Credits
=======
@ -65,9 +64,10 @@ Credits
Contributors
------------
* Rafael Blasco <rafabn@antiun.com>
* Antonio Espinosa <antonioea@antiun.com>
* Jairo Llopis <yajo.sk8@gmail.com>
* Rafael Blasco <rafael.blasco@tecnativa.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Jairo Llopis <jairo.llopis@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
Maintainer
----------
@ -82,4 +82,4 @@ 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 http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

3
base_location_nuts/__init__.py

@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from . import models
from . import wizard

35
base_location_nuts/__manifest__.py

@ -1,32 +1,15 @@
# -*- coding: utf-8 -*-
# Python source code encoding : https://www.python.org/dev/peps/pep-0263/
##############################################################################
#
# OpenERP, Odoo Source Management Solution
# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
# Antonio Espinosa <antonioea@antiun.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/>.
#
##############################################################################
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'NUTS Regions',
'category': 'Localisation/Europe',
'version': '8.0.2.0.0',
'version': '10.0.1.0.0',
'depends': [
'base',
'sales_team',
],
'data': [
'views/res_country_view.xml',
@ -38,9 +21,9 @@
'images': [
'images/new_fields.png',
],
'author': 'Antiun Ingeniería S.L., '
'author': 'Tecnativa, '
'Odoo Community Association (OCA)',
'website': 'http://www.antiun.com',
'website': 'https://www.tecnativa.com',
'license': 'AGPL-3',
'installable': False,
'installable': True,
}

213
base_location_nuts/i18n/de.po

@ -0,0 +1,213 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_location_nuts
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2015
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-25 01:50+0000\n"
"PO-Revision-Date: 2015-11-25 11:07+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (https://www.transifex.com/oca/OCA-partner-contact-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Cancel"
msgstr "abbrechen"
#. module: base_location_nuts
#: field:res.partner.nuts,children:0
msgid "Children"
msgstr "Untergeordnete"
#. module: base_location_nuts
#: field:res.partner.nuts,code:0
msgid "Code"
msgstr "Schlüssel"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,country_id:0
msgid "Country"
msgstr "Land"
#. module: base_location_nuts
#: field:nuts.import,create_uid:0 field:res.partner.nuts,create_uid:0
msgid "Created by"
msgstr "erstellt von"
#. module: base_location_nuts
#: field:nuts.import,create_date:0 field:res.partner.nuts,create_date:0
msgid "Created on"
msgstr "erstellt am"
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:130
#, python-format
msgid "Downloaded file is not a valid XML file"
msgstr "Heruntergeladene Datei scheint keine gültige XML-Datei zu sein"
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:122
#, python-format
msgid "Got an error %d when trying to download the file %s."
msgstr "Erhielt einen Fehler %d beim Versuch die Datei %s herunter zu laden."
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:118
#, python-format
msgid "Got an error when trying to download the file: %s."
msgstr "Erhielt einen Fehler beim Versuch die Datei %s herunterzuladen."
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Group By"
msgstr "Gruppieren"
#. module: base_location_nuts
#: field:nuts.import,id:0 field:res.partner.nuts,id:0
msgid "ID"
msgstr "ID"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import"
msgstr "Import"
#. module: base_location_nuts
#: model:ir.ui.menu,name:base_location_nuts.nuts_import_menu
msgid "Import NUTS 2013"
msgstr "Importiere NUTS 2013"
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.nuts_import_action
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import NUTS 2013 from RAMON"
msgstr "Importiere NUTS 2013 von RAMON"
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_nuts_import
msgid "Import NUTS items from European RAMON service"
msgstr "Importiere NUTS-Elemente vom Europäischen RAMON-Dienst"
#. module: base_location_nuts
#: field:nuts.import,write_uid:0 field:res.partner.nuts,write_uid:0
msgid "Last Updated by"
msgstr "zuletzt aktualisiert von"
#. module: base_location_nuts
#: field:nuts.import,write_date:0 field:res.partner.nuts,write_date:0
msgid "Last Updated on"
msgstr "zuletzt aktualisiert am"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,level:0
msgid "Level"
msgstr "Stufe"
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner_nuts
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_form
msgid "NUTS Item"
msgstr "NUTS-Element"
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.res_partner_nuts_action
#: model:ir.ui.menu,name:base_location_nuts.res_partner_nuts_menu
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_tree
msgid "NUTS Items"
msgstr "NUTS-Elemente"
#. module: base_location_nuts
#: field:res.partner.nuts,name:0
msgid "Name"
msgstr "Name"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_left:0
msgid "Parent Left"
msgstr "Übergeordnet links"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_right:0
msgid "Parent Right"
msgstr "Übergeordnet rechts"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_id:0
msgid "Parent id"
msgstr "Übergeordnet-ID"
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner
msgid "Partner"
msgstr "Partner"
#. module: base_location_nuts
#: code:addons/base_location_nuts/models/res_partner.py:34
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,region:0
#, python-format
msgid "Region"
msgstr "Region"
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
msgid "Salesperson"
msgstr "Verkäufer"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Search NUTS"
msgstr "Suche in NUTS"
#. module: base_location_nuts
#: field:res.partner.nuts,state_id:0
msgid "State"
msgstr "Bundesland"
#. module: base_location_nuts
#: code:addons/base_location_nuts/models/res_partner.py:35
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,substate:0
#, python-format
msgid "Substate"
msgstr "Unterstatus"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid ""
"This wizard will download the lastest version of\n"
" NUTS 2013 from Europe RAMON metadata service.\n"
" Updating or creating new NUTS entries if not\n"
" found already in the system, and DELETING MISSING\n"
" ENTRIES from new downloaded file."
msgstr "Dieser Assisten lädt die neueste Version des NUTS vom Europäischen RAMON Metadatendienst herunter. NUTS-Einträge werden aktualisiert oder angelegt, wenn sie nicht bereits im System vorhanden sind und werden GELÖSCHT, wenn sie in der neuen Datei fehlen."
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:97
#, python-format
msgid "Value not found for mandatory field %s"
msgstr "Wert für Pflichtfeld %s nicht gefunden"
#. module: base_location_nuts
#: model:ir.actions.todo,note:base_location_nuts.config_wizard_nuts
msgid "You can import NUTS from RAMON european service."
msgstr "Sie können NUTS vom Europäischen RAMON-Dienst importieren"
#. module: base_location_nuts
#: model:ir.actions.act_window,help:base_location_nuts.res_partner_nuts_action
msgid ""
"You must click at import wizard to populate NUTS items\n"
" in Odoo database in:\n"
" Sales > Configuration > Address Book > Localization > Import NUTS 2013"
msgstr "Sie müssen den Import-Assistenten wählen, um NUTS-Elemente aus NUTS in Odoo zu importieren:\nVerkauf -> Konfiguration -> Adressbuch Lokalisierung -> Importiere NUTS 2013"

2
base_location_nuts/i18n/es.po

@ -10,7 +10,7 @@ msgstr ""
"POT-Creation-Date: 2015-12-30 17:07+0100\n"
"PO-Revision-Date: 2015-12-30 17:11+0100\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-partner-contact-8-0/"
"Language-Team: Spanish (https://www.transifex.com/oca/OCA-partner-contact-8-0/"
"language/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"

212
base_location_nuts/i18n/fi.po

@ -0,0 +1,212 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_location_nuts
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-19 01:46+0000\n"
"PO-Revision-Date: 2015-10-06 13:57+0000\n"
"Last-Translator: <>\n"
"Language-Team: Finnish (https://www.transifex.com/oca/OCA-partner-contact-8-0/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Cancel"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,children:0
msgid "Children"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,code:0
msgid "Code"
msgstr ""
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,country_id:0
msgid "Country"
msgstr "Maa"
#. module: base_location_nuts
#: field:nuts.import,create_uid:0 field:res.partner.nuts,create_uid:0
msgid "Created by"
msgstr "Luonut"
#. module: base_location_nuts
#: field:nuts.import,create_date:0 field:res.partner.nuts,create_date:0
msgid "Created on"
msgstr "Luotu"
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:130
#, python-format
msgid "Downloaded file is not a valid XML file"
msgstr ""
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:122
#, python-format
msgid "Got an error %d when trying to download the file %s."
msgstr ""
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:118
#, python-format
msgid "Got an error when trying to download the file: %s."
msgstr ""
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Group By"
msgstr ""
#. module: base_location_nuts
#: field:nuts.import,id:0 field:res.partner.nuts,id:0
msgid "ID"
msgstr "ID"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import"
msgstr ""
#. module: base_location_nuts
#: model:ir.ui.menu,name:base_location_nuts.nuts_import_menu
msgid "Import NUTS 2013"
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.nuts_import_action
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import NUTS 2013 from RAMON"
msgstr ""
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_nuts_import
msgid "Import NUTS items from European RAMON service"
msgstr ""
#. module: base_location_nuts
#: field:nuts.import,write_uid:0 field:res.partner.nuts,write_uid:0
msgid "Last Updated by"
msgstr "Viimeksi päivitetty"
#. module: base_location_nuts
#: field:nuts.import,write_date:0 field:res.partner.nuts,write_date:0
msgid "Last Updated on"
msgstr "Viimeksi päivittänyt"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,level:0
msgid "Level"
msgstr ""
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner_nuts
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_form
msgid "NUTS Item"
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.res_partner_nuts_action
#: model:ir.ui.menu,name:base_location_nuts.res_partner_nuts_menu
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_tree
msgid "NUTS Items"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,name:0
msgid "Name"
msgstr "Nimi"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_left:0
msgid "Parent Left"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,parent_right:0
msgid "Parent Right"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,parent_id:0
msgid "Parent id"
msgstr ""
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner
msgid "Partner"
msgstr "Kumppani"
#. module: base_location_nuts
#: code:addons/base_location_nuts/models/res_partner.py:34
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,region:0
#, python-format
msgid "Region"
msgstr ""
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
msgid "Salesperson"
msgstr "Myyjä"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Search NUTS"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,state_id:0
msgid "State"
msgstr ""
#. module: base_location_nuts
#: code:addons/base_location_nuts/models/res_partner.py:35
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,substate:0
#, python-format
msgid "Substate"
msgstr ""
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid ""
"This wizard will download the lastest version of\n"
" NUTS 2013 from Europe RAMON metadata service.\n"
" Updating or creating new NUTS entries if not\n"
" found already in the system, and DELETING MISSING\n"
" ENTRIES from new downloaded file."
msgstr ""
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:97
#, python-format
msgid "Value not found for mandatory field %s"
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.todo,note:base_location_nuts.config_wizard_nuts
msgid "You can import NUTS from RAMON european service."
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.act_window,help:base_location_nuts.res_partner_nuts_action
msgid ""
"You must click at import wizard to populate NUTS items\n"
" in Odoo database in:\n"
" Sales > Configuration > Address Book > Localization > Import NUTS 2013"
msgstr ""

237
base_location_nuts/i18n/it.po

@ -0,0 +1,237 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_location_nuts
#
# Translators:
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-13 00:57+0000\n"
"PO-Revision-Date: 2016-03-13 17:23+0000\n"
"Last-Translator: Paolo Valier\n"
"Language-Team: Italian (https://www.transifex.com/oca/OCA-partner-contact-8-0/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Cancel"
msgstr "Annulla"
#. module: base_location_nuts
#: field:res.partner.nuts,child_ids:0
msgid "Children"
msgstr "Figlio"
#. module: base_location_nuts
#: field:res.partner.nuts,code:0
msgid "Code"
msgstr "Codice"
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_country
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,country_id:0
msgid "Country"
msgstr "Nazione"
#. module: base_location_nuts
#: field:nuts.import,create_uid:0 field:res.partner.nuts,create_uid:0
msgid "Created by"
msgstr "Creato da"
#. module: base_location_nuts
#: field:nuts.import,create_date:0 field:res.partner.nuts,create_date:0
msgid "Created on"
msgstr "Creato il"
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:128
#, python-format
msgid "Downloaded file is not a valid XML file"
msgstr "Il file scaricato non è un file XML valido"
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:120
#, python-format
msgid "Got an error %d when trying to download the file %s."
msgstr ""
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:116
#, python-format
msgid "Got an error when trying to download the file: %s."
msgstr ""
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Group By"
msgstr "Raggruppa per"
#. module: base_location_nuts
#: field:nuts.import,id:0 field:res.partner.nuts,id:0
msgid "ID"
msgstr "ID"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import"
msgstr "Importa"
#. module: base_location_nuts
#: model:ir.ui.menu,name:base_location_nuts.nuts_import_menu
msgid "Import NUTS 2013"
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.nuts_import_action
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import NUTS 2013 from RAMON"
msgstr ""
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_nuts_import
msgid "Import NUTS items from European RAMON service"
msgstr ""
#. module: base_location_nuts
#: field:nuts.import,write_uid:0 field:res.partner.nuts,write_uid:0
msgid "Last Updated by"
msgstr "Ultimo aggiornamento di"
#. module: base_location_nuts
#: field:nuts.import,write_date:0 field:res.partner.nuts,write_date:0
msgid "Last Updated on"
msgstr "Ultimo aggiornamento il"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,level:0
msgid "Level"
msgstr "Livello"
#. module: base_location_nuts
#: help:res.country,state_level:0
msgid "Level for the state NUTS category."
msgstr ""
#. module: base_location_nuts
#: view:res.country:base_location_nuts.view_country_form
msgid "NUTS"
msgstr ""
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner_nuts
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_form
msgid "NUTS Item"
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.res_partner_nuts_action
#: model:ir.ui.menu,name:base_location_nuts.res_partner_nuts_menu
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_tree
msgid "NUTS Items"
msgstr ""
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,nuts1_id:0
msgid "NUTS L1"
msgstr ""
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,nuts2_id:0
msgid "NUTS L2"
msgstr ""
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,nuts3_id:0
msgid "NUTS L3"
msgstr ""
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,nuts4_id:0
msgid "NUTS L4"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,name:0
msgid "Name"
msgstr "Nome"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_left:0
msgid "Parent Left"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,parent_right:0
msgid "Parent Right"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,parent_id:0
msgid "Parent id"
msgstr ""
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner
msgid "Partner"
msgstr "Partner"
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
msgid "Salesperson"
msgstr ""
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Search NUTS"
msgstr ""
#. module: base_location_nuts
#: field:res.partner.nuts,state_id:0
msgid "State"
msgstr "Provincia"
#. module: base_location_nuts
#: field:res.country,state_level:0
msgid "State level"
msgstr ""
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid ""
"This wizard will download the lastest version of\n"
" NUTS 2013 from Europe RAMON metadata service.\n"
" Updating or creating new NUTS entries if not\n"
" found already in the system, and DELETING MISSING\n"
" ENTRIES from new downloaded file."
msgstr ""
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:95
#, python-format
msgid "Value not found for mandatory field %s"
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.todo,note:base_location_nuts.config_wizard_nuts
msgid "You can import NUTS from RAMON european service."
msgstr ""
#. module: base_location_nuts
#: model:ir.actions.act_window,help:base_location_nuts.res_partner_nuts_action
msgid ""
"You must click at import wizard to populate NUTS items\n"
" in Odoo database in:\n"
" Sales > Configuration > Address Book > Localization > Import NUTS 2013"
msgstr ""

213
base_location_nuts/i18n/sl.po

@ -0,0 +1,213 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_location_nuts
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-09 15:48+0000\n"
"PO-Revision-Date: 2015-10-07 10:36+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/OCA-partner-contact-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Cancel"
msgstr "Preklic"
#. module: base_location_nuts
#: field:res.partner.nuts,children:0
msgid "Children"
msgstr "Podrejeni"
#. module: base_location_nuts
#: field:res.partner.nuts,code:0
msgid "Code"
msgstr "Koda"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,country_id:0
msgid "Country"
msgstr "Država"
#. module: base_location_nuts
#: field:nuts.import,create_uid:0 field:res.partner.nuts,create_uid:0
msgid "Created by"
msgstr "Ustvaril"
#. module: base_location_nuts
#: field:nuts.import,create_date:0 field:res.partner.nuts,create_date:0
msgid "Created on"
msgstr "Ustvarjeno"
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:130
#, python-format
msgid "Downloaded file is not a valid XML file"
msgstr "Prenesena datoteka ni veljavna XML datoteka"
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:122
#, python-format
msgid "Got an error %d when trying to download the file %s."
msgstr "Napaka %d pri poskusu prenosa datoteke %s."
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:118
#, python-format
msgid "Got an error when trying to download the file: %s."
msgstr "Napaka pri poskusu prenosa datoteke: %s."
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Group By"
msgstr "Združi po"
#. module: base_location_nuts
#: field:nuts.import,id:0 field:res.partner.nuts,id:0
msgid "ID"
msgstr "ID"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import"
msgstr "Uvoz"
#. module: base_location_nuts
#: model:ir.ui.menu,name:base_location_nuts.nuts_import_menu
msgid "Import NUTS 2013"
msgstr "Uvoz NUTS 2013"
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.nuts_import_action
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid "Import NUTS 2013 from RAMON"
msgstr "Uvoz NUTS 2013 iz RAMON"
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_nuts_import
msgid "Import NUTS items from European RAMON service"
msgstr "Uvoz NUTS postavk iz evropske RAMON storitve"
#. module: base_location_nuts
#: field:nuts.import,write_uid:0 field:res.partner.nuts,write_uid:0
msgid "Last Updated by"
msgstr "Zadnji posodobil"
#. module: base_location_nuts
#: field:nuts.import,write_date:0 field:res.partner.nuts,write_date:0
msgid "Last Updated on"
msgstr "Zadnjič posodobljeno"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
#: field:res.partner.nuts,level:0
msgid "Level"
msgstr "Nivo"
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner_nuts
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_form
msgid "NUTS Item"
msgstr "NUTS postavka"
#. module: base_location_nuts
#: model:ir.actions.act_window,name:base_location_nuts.res_partner_nuts_action
#: model:ir.ui.menu,name:base_location_nuts.res_partner_nuts_menu
#: view:res.partner.nuts:base_location_nuts.res_partner_nuts_tree
msgid "NUTS Items"
msgstr "NUTS postavke"
#. module: base_location_nuts
#: field:res.partner.nuts,name:0
msgid "Name"
msgstr "Naziv"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_left:0
msgid "Parent Left"
msgstr "Levo nadrejeni"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_right:0
msgid "Parent Right"
msgstr "Desno nadrejeni"
#. module: base_location_nuts
#: field:res.partner.nuts,parent_id:0
msgid "Parent id"
msgstr "ID nadrejenega"
#. module: base_location_nuts
#: model:ir.model,name:base_location_nuts.model_res_partner
msgid "Partner"
msgstr "Partner"
#. module: base_location_nuts
#: code:addons/base_location_nuts/models/res_partner.py:34
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,region:0
#, python-format
msgid "Region"
msgstr "Regija"
#. module: base_location_nuts
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
msgid "Salesperson"
msgstr "Prodajalec"
#. module: base_location_nuts
#: view:res.partner.nuts:base_location_nuts.view_res_partner_nuts_filter
msgid "Search NUTS"
msgstr "Iskanje NUTS"
#. module: base_location_nuts
#: field:res.partner.nuts,state_id:0
msgid "State"
msgstr "Zvezna država"
#. module: base_location_nuts
#: code:addons/base_location_nuts/models/res_partner.py:35
#: view:res.partner:base_location_nuts.view_res_partner_filter_nuts
#: field:res.partner,substate:0
#, python-format
msgid "Substate"
msgstr "Pod-država"
#. module: base_location_nuts
#: view:nuts.import:base_location_nuts.nuts_import_form
msgid ""
"This wizard will download the lastest version of\n"
" NUTS 2013 from Europe RAMON metadata service.\n"
" Updating or creating new NUTS entries if not\n"
" found already in the system, and DELETING MISSING\n"
" ENTRIES from new downloaded file."
msgstr "Ta čarovnik bo prenesel zadnjo verzijo\n NUTS 2013 iz evropske RAMON metadata storitve.\n Posodabljanje ali ustvarjanje novih NUTS vnosov, če\n niso že v sistemu in BRISANJE MANJKAJOČIH\n VNOSOV iz prenesene datoteke."
#. module: base_location_nuts
#: code:addons/base_location_nuts/wizard/nuts_import.py:97
#, python-format
msgid "Value not found for mandatory field %s"
msgstr "Vrednost obveznega polja %s ni najdena"
#. module: base_location_nuts
#: model:ir.actions.todo,note:base_location_nuts.config_wizard_nuts
msgid "You can import NUTS from RAMON european service."
msgstr "Uvozite lahko NUTS iz RAMON evropske storitve."
#. module: base_location_nuts
#: model:ir.actions.act_window,help:base_location_nuts.res_partner_nuts_action
msgid ""
"You must click at import wizard to populate NUTS items\n"
" in Odoo database in:\n"
" Sales > Configuration > Address Book > Localization > Import NUTS 2013"
msgstr "Kliknite na čarovnik za uvoz za naselitev NUTS postavk\n v Odoo podatkovno bazo v:\n Prodaja > Nastavitve > Imenik > Lokalizacija > Uvoz NUTS 2013"

11
base_location_nuts/models/__init__.py

@ -1,10 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import (
res_country,
res_partner_nuts,
res_partner,
)
from . import res_country
from . import res_partner
from . import res_partner_nuts

8
base_location_nuts/models/res_country.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
from odoo import fields, models
class ResCountry(models.Model):

58
base_location_nuts/models/res_partner.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
from odoo import api, fields, models
class ResPartner(models.Model):
@ -22,24 +22,24 @@ class ResPartner(models.Model):
comodel_name='res.partner.nuts', domain=[('level', '=', 4)],
string="NUTS L4")
@api.multi
def _onchange_nuts(self, level):
field = self["nuts%d_id" % level]
country_id = field.country_id.id
state_id = field.state_id.id
if country_id and self.country_id.id != country_id:
country_id = field.country_id
state_id = field.state_id
if country_id and self.country_id != country_id:
self.country_id = country_id
if state_id and self.state_id.id != state_id:
if state_id and self.state_id != state_id:
self.state_id = state_id
if (level - 1) > 0:
parent_id = field.parent_id.id
if level > 1:
parent_id = field.parent_id
if parent_id:
parent_field = 'nuts%d_id' % (level - 1)
if self[parent_field].id != parent_id:
self[parent_field] = parent_id
result = dict()
nuts_parent_level = 'nuts%d_id' % (level - 1)
parent_field = self[nuts_parent_level]
if parent_field != parent_id:
self[nuts_parent_level] = parent_id
result = {}
if country_id and level < 4:
result['domain'] = dict()
result['domain'] = {}
while level < 4:
parent_field = 'nuts%d_id' % level
domain_field = 'nuts%d_id' % (level + 1)
@ -51,27 +51,22 @@ class ResPartner(models.Model):
level += 1
return result
@api.multi
@api.onchange('nuts4_id')
def _onchange_nuts4_id(self):
return self._onchange_nuts(4)
@api.multi
@api.onchange('nuts3_id')
def _onchange_nuts3_id(self):
return self._onchange_nuts(3)
@api.multi
@api.onchange('nuts2_id')
def _onchange_nuts2_id(self):
return self._onchange_nuts(2)
@api.multi
@api.onchange('nuts1_id')
def _onchange_nuts1_id(self):
return self._onchange_nuts(1)
@api.multi
@api.onchange('country_id')
def _onchange_country_id(self):
"""Sensible values and domains for related fields."""
@ -85,8 +80,7 @@ class ResPartner(models.Model):
domain[field] = list(country_domain) # Using list() to copy
fields.remove('state_id')
for field in fields:
level = int(field[:5][-1])
if level:
level = int(field[4])
domain[field].append(('level', '=', level))
if self.country_id:
nuts1 = self.env['res.partner.nuts'].search([
@ -99,20 +93,18 @@ class ResPartner(models.Model):
'domain': domain,
}
@api.multi
def onchange_state(self, state_id):
result = super(ResPartner, self).onchange_state(state_id)
state = self.env['res.country.state'].browse(state_id)
if state.country_id.state_level:
@api.onchange('state_id')
def onchange_state_id_base_location_nuts(self):
if self.state_id:
self.country_id = self.state_id.country_id
if self.state_id.country_id.state_level:
nuts_state = self.env['res.partner.nuts'].search([
('level', '=', state.country_id.state_level),
('state_id', '=', state.id)
('level', '=', self.state_id.country_id.state_level),
('state_id', '=', self.state_id.id)
], limit=1)
if nuts_state:
field = 'nuts%d_id' % state.country_id.state_level
result.setdefault("value", dict())
result['value'][field] = nuts_state.id
return result
field = 'nuts%d_id' % self.state_id.country_id.state_level
self[field] = nuts_state
@api.model
def _address_fields(self):

29
base_location_nuts/models/res_partner_nuts.py

@ -1,33 +1,32 @@
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# -*- coding: utf-8 -*-
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
from odoo import fields, models
class ResPartnerNuts(models.Model):
_name = 'res.partner.nuts'
_order = "parent_left"
_parent_order = "name"
_order = 'parent_left'
_parent_order = 'name'
_parent_store = True
_description = "NUTS Item"
_description = 'NUTS Item'
# NUTS fields
level = fields.Integer(required=True)
code = fields.Char(required=True)
name = fields.Char(required=True, translate=True)
country_id = fields.Many2one(comodel_name='res.country', string="Country",
country_id = fields.Many2one(comodel_name='res.country', string='Country',
required=True)
state_id = fields.Many2one(comodel_name='res.country.state',
string='State')
# Parent hierarchy
parent_id = fields.Many2one(comodel_name='res.partner.nuts',
ondelete='restrict')
child_ids = fields.One2many(
'res.partner.nuts',
'parent_id',
"Children",
oldname="children")
parent_left = fields.Integer('Parent Left', select=True)
parent_right = fields.Integer('Parent Right', select=True)
child_ids = fields.One2many(comodel_name='res.partner.nuts',
inverse_name='parent_id', string='Children',
oldname='children')
parent_left = fields.Integer('Parent Left', index=True)
parent_right = fields.Integer('Parent Right', index=True)

3
base_location_nuts/tests/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import test_base_location_nuts

90
base_location_nuts/tests/test_base_location_nuts.py

@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
from odoo.exceptions import UserError
class TestBaseLocationNuts(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestBaseLocationNuts, cls).setUpClass()
cls.importer = cls.env['nuts.import']
cls.importer.run_import() # loads nuts
cls.country_1 = cls.env['res.country'].search([('code', '=', 'ES')])
cls.country_2 = cls.env['res.country'].search([('code', '=', 'PT')])
cls.nuts1_2 = cls.env[
'res.partner.nuts'].search([('code', '=', 'PT')])
cls.nuts2_1 = cls.env[
'res.partner.nuts'].search([('code', '=', 'ES2')])
cls.nuts3_1 = cls.env[
'res.partner.nuts'].search([('code', '=', 'ES24')])
cls.nuts4_1 = cls.env[
'res.partner.nuts'].search([('code', '=', 'ES243')])
cls.nuts4_2 = cls.env[
'res.partner.nuts'].search([('code', '=', 'ES300')])
cls.partner = cls.env['res.partner'].create({
'name': 'Test partner',
'country_id': cls.country_1.id,
})
cls.state_1 = cls.env['res.country.state'].create({
'name': 'Zaragoza Test',
'code': 'ZT',
'country_id': cls.country_1.id,
})
cls.nuts4_1.state_id = cls.state_1
cls.state_2 = cls.env['res.country.state'].create({
'name': 'Madrid Test',
'code': 'MT',
'country_id': cls.country_1.id,
})
cls.nuts4_2.state_id = cls.state_2
cls.country_1.state_level = 4
def test_onchange_nuts_country(self):
self.partner.nuts1_id = self.nuts1_2
self.partner._onchange_nuts1_id()
self.assertEqual(self.partner.country_id, self.nuts1_2.country_id)
def test_onchange_nuts(self):
self.partner.country_id = self.country_2
self.partner._onchange_country_id()
self.assertEqual(self.partner.nuts1_id.country_id,
self.partner.country_id)
self.partner.nuts4_id = self.nuts4_1
self.partner._onchange_nuts4_id()
self.assertEqual(self.partner.country_id,
self.country_1)
self.assertEqual(self.partner.nuts3_id, self.nuts3_1)
self.partner._onchange_nuts3_id()
self.assertEqual(self.partner.nuts2_id, self.nuts2_1)
self.partner._onchange_nuts2_id()
self.assertEqual(self.partner.nuts1_id.country_id, self.country_1)
self.partner.country_id = self.country_2
self.partner._onchange_country_id()
self.assertEqual(self.partner.country_id, self.nuts1_2.country_id)
self.assertFalse(self.partner.nuts2_id)
self.assertFalse(self.partner.nuts3_id)
self.assertFalse(self.partner.nuts4_id)
def test_onchange_states(self):
self.partner.state_id = self.state_2
self.partner.onchange_state_id_base_location_nuts()
self.assertEqual(self.state_2, self.partner.nuts4_id.state_id)
self.partner.state_id = self.state_1
self.partner.onchange_state_id_base_location_nuts()
self.assertEqual(self.state_1, self.partner.nuts4_id.state_id)
self.partner._onchange_nuts4_id()
self.assertEqual(self.partner.nuts3_id, self.nuts3_1)
self.partner._onchange_nuts3_id()
self.assertEqual(self.partner.nuts2_id, self.nuts2_1)
self.partner._onchange_nuts2_id()
self.assertEqual(self.partner.nuts1_id.country_id, self.country_1)
def test_download_exceptions(self):
""" Tests download exceptions """
with self.assertRaises(UserError):
self.importer._download_nuts(url_base='htttt://test.com')
with self.assertRaises(UserError):
self.importer._download_nuts(url_base='http://ec.europa.eu/_404')

10
base_location_nuts/views/res_country_view.xml

@ -1,10 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2015 Antiun Ingeniería S.L. - Jairo Llopis
© 2015 Antiun Ingeniería S.L. - Antonio Espinosa
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record id="view_country_form" model="ir.ui.view">
<field name="name">NUTS fields</field>
@ -21,5 +16,4 @@
</field>
</record>
</data>
</openerp>
</odoo>

11
base_location_nuts/views/res_partner_nuts_view.xml

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2015 Antiun Ingeniería S.L. - Jairo Llopis
© 2015 Antiun Ingeniería S.L. - Antonio Espinosa
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record id="res_partner_nuts_tree" model="ir.ui.view">
<field name="name">NUTS Items tree</field>
@ -72,8 +68,7 @@
<menuitem action="res_partner_nuts_action"
id="res_partner_nuts_menu"
name="NUTS Items"
parent="base.menu_localisation"
parent="sales_team.menu_localisation"
sequence="40"/>
</data>
</openerp>
</odoo>

11
base_location_nuts/views/res_partner_view.xml

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2015 Antiun Ingeniería S.L. - Jairo Llopis
© 2015 Antiun Ingeniería S.L. - Antonio Espinosa
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record model="ir.ui.view" id="view_partner_form_nuts">
<field name="name">Partner form with NUTS</field>
@ -36,7 +32,7 @@
<field name="nuts3_id"/>
<field name="nuts4_id"/>
</field>
<filter string="Salesperson" position="after">
<filter name="salesperson" position="after">
<filter string="NUTS L1"
domain="[]"
context="{'group_by': 'nuts1_id'}"/>
@ -53,5 +49,4 @@
</field>
</record>
</data>
</openerp>
</odoo>

3
base_location_nuts/wizard/__init__.py

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import nuts_import

46
base_location_nuts/wizard/nuts_import.py

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2017 David Vidal <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import models, api, _
from openerp.exceptions import Warning as UserError
from odoo import _, api, models
from odoo.exceptions import UserError
import requests
import re
import logging
@ -13,6 +14,16 @@ from collections import OrderedDict
logger = logging.getLogger(__name__)
# Default server values
URL_BASE = 'http://ec.europa.eu'
URL_PATH = '/eurostat/ramon/nomenclatures/index.cfm'
URL_PARAMS = {'TargetUrl': 'ACT_OTH_CLS_DLD',
'StrNom': 'NUTS_2013',
'StrFormat': 'XML',
'StrLanguageCode': 'EN',
'StrLayoutCode': 'HIERARCHIC'
}
class NutsImport(models.TransientModel):
_name = 'nuts.import'
@ -96,16 +107,13 @@ class NutsImport(models.TransientModel):
item[k] = value
return item
def _download_nuts(self):
url_base = 'http://ec.europa.eu'
url_path = '/eurostat/ramon/nomenclatures/index.cfm'
url_params = {
'TargetUrl': 'ACT_OTH_CLS_DLD',
'StrNom': 'NUTS_2013',
'StrFormat': 'XML',
'StrLanguageCode': 'EN',
'StrLayoutCode': 'HIERARCHIC'
}
def _download_nuts(self, url_base=None, url_path=None, url_params=None):
if not url_base:
url_base = URL_BASE
if not url_path:
url_path = URL_PATH
if not url_params:
url_params = URL_PARAMS
url = url_base + url_path + '?'
url += '&'.join([k + '=' + v for k, v in url_params.iteritems()])
logger.info('Starting to download %s' % url)
@ -171,7 +179,7 @@ class NutsImport(models.TransientModel):
self._parents[level - 1] = nuts.id
return nuts
@api.one
@api.multi
def run_import(self):
nuts_model = self.env['res.partner.nuts'].\
with_context(defer_parent_store_computation=True)
@ -181,12 +189,11 @@ class NutsImport(models.TransientModel):
nuts_to_delete = nuts_model.search(
[('country_id', 'in', [x.id for x in self._countries.values()])])
# Download NUTS in english, create or update
logger.info('Importing NUTS 2013 English')
logger.info('Importing NUTS 2013 English...')
xmlcontent = self._download_nuts()
dom = etree.fromstring(xmlcontent)
for node in dom.iter('Item'):
logger.debug(
'Reading level=%s, id=%s',
logger.debug('Reading level=%s, id=%s',
node.get('idLevel', 'N/A'),
node.get('id', 'N/A'))
nuts = self.create_or_update_nuts(node)
@ -199,5 +206,4 @@ class NutsImport(models.TransientModel):
logger.info(
'The wizard to create NUTS entries from RAMON '
'has been successfully completed.')
return True

11
base_location_nuts/wizard/nuts_import_view.xml

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2015 Antiun Ingeniería S.L. - Jairo Llopis
© 2015 Antiun Ingeniería S.L. - Antonio Espinosa
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record id="nuts_import_form" model="ir.ui.view">
<field name="name">NUTS import</field>
@ -39,7 +35,7 @@
<menuitem action="nuts_import_action"
id="nuts_import_menu"
name="Import NUTS 2013"
parent="base.menu_localisation"
parent="sales_team.menu_localisation"
sequence="45"/>
<record id="config_wizard_nuts" model="ir.actions.todo">
@ -50,5 +46,4 @@
<field name="type">automatic</field>
</record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save