From 0c137169d744952cd3f353613b4d997645c33510 Mon Sep 17 00:00:00 2001 From: Antonio Espinosa Date: Tue, 31 Mar 2015 17:05:25 +0200 Subject: [PATCH 01/19] [ADD] Add l10n_es_location_nuts addon --- l10n_es_location_nuts/README.rst | 66 +++++++++++++ l10n_es_location_nuts/__init__.py | 8 ++ l10n_es_location_nuts/__openerp__.py | 22 +++++ l10n_es_location_nuts/hooks.py | 25 +++++ l10n_es_location_nuts/i18n/es.po | 39 ++++++++ .../i18n/l10n_es_location_nuts.pot | 39 ++++++++ l10n_es_location_nuts/models/__init__.py | 6 ++ l10n_es_location_nuts/models/res_partner.py | 76 +++++++++++++++ .../static/description/icon.png | Bin 0 -> 6868 bytes l10n_es_location_nuts/wizard/__init__.py | 6 ++ l10n_es_location_nuts/wizard/nuts_import.py | 88 ++++++++++++++++++ 11 files changed, 375 insertions(+) create mode 100644 l10n_es_location_nuts/README.rst create mode 100644 l10n_es_location_nuts/__init__.py create mode 100644 l10n_es_location_nuts/__openerp__.py create mode 100644 l10n_es_location_nuts/hooks.py create mode 100644 l10n_es_location_nuts/i18n/es.po create mode 100644 l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot create mode 100644 l10n_es_location_nuts/models/__init__.py create mode 100644 l10n_es_location_nuts/models/res_partner.py create mode 100644 l10n_es_location_nuts/static/description/icon.png create mode 100644 l10n_es_location_nuts/wizard/__init__.py create mode 100644 l10n_es_location_nuts/wizard/nuts_import.py diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst new file mode 100644 index 00000000000..f4cb4441c62 --- /dev/null +++ b/l10n_es_location_nuts/README.rst @@ -0,0 +1,66 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License + +Regiones NUTS para España +========================= + +Este módulo permite importar las regiones NUTS para España. + +* Provincias españolas (NUTS level 4) como Provincia en el formulario de Empresa + (res.partner.state_id) +* Comunidades autónomas españolas (NUTS level 3) como Comunidad Autónoma en el + formulario de Empresa (res.partner.substate) +* Regiones españolas (NUTS level 2) como Regiones en el formulario de Empresa + (res.partner.region) + + +Instalación +=========== + +Para instalar éste addon, necesitarás el módulo python 'request': + +* pip intall requests + + +Configuración +============= + +Después de instalar, debes clicar en el asistente de importación para añadir +las regiones NUTS en la base de datos de Odoo. +Ventas > Configuración > Libreta de direcciones > Importar NUTS 2013 + +Este asistente descargará del servicio europeo RAMON los metadatos para añadir +las regiones NUTS en Odoo. Este módulo específico de la localización española +hereda este asistente genérico para relacionar cada region NUTS española con las +provincias españolas definidas en el módulo l10n_es_toponyms + + +Uso +===== + +Sólo el administrador puede gestionar las regiones NUTS (realmente no es necesario +porque es una convención a nivel Europeo) pero cualquier usuario puede leerlas, +para que pueda asignarlas en eel objeto Empresa (res.partner) + + +Créditos +======== + +Contribudores +------------- +* Antonio Espinosa + +Mantenido por +------------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +Este módulo lo mantiene la OCA. + +OCA (Odoo Community Association) es una organización sin ánimo de lucro cuya +misión es mantener el desarrollo colaborativo de funcionalidad de Odoo +y promocionar su uso por todo el mundo. + +Para contribuir a éste módulo, por favor visita http://odoo-community.org diff --git a/l10n_es_location_nuts/__init__.py b/l10n_es_location_nuts/__init__.py new file mode 100644 index 00000000000..50d66b61394 --- /dev/null +++ b/l10n_es_location_nuts/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa +# © 2015 Antiun Ingenieria S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models +from . import wizard +from .hooks import post_init_hook diff --git a/l10n_es_location_nuts/__openerp__.py b/l10n_es_location_nuts/__openerp__.py new file mode 100644 index 00000000000..facc6a24b5e --- /dev/null +++ b/l10n_es_location_nuts/__openerp__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa +# © 2015 Antiun Ingenieria S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'NUTS Regions for Spain', + 'summary': 'NUTS specific options for Spain', + 'version': '8.0.1.0.0', + 'category': 'Localisation/Europe', + 'website': 'http://www.antiun.com', + 'author': 'Antiun Ingeniería S.L., ' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'depends': [ + 'base_location_nuts', + 'l10n_es_toponyms', + ], + 'post_init_hook': 'post_init_hook', +} diff --git a/l10n_es_location_nuts/hooks.py b/l10n_es_location_nuts/hooks.py new file mode 100644 index 00000000000..969ce7d359c --- /dev/null +++ b/l10n_es_location_nuts/hooks.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa +# © 2015 Antiun Ingenieria S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import api, SUPERUSER_ID +import logging + +_logger = logging.getLogger(__name__) + + +def post_init_hook(cr, registry): + """Define Spanish specific configuration in res.country.""" + with api.Environment.manage(): + env = api.Environment(cr, SUPERUSER_ID, {}) + spain = env.ref('base.es') + _logger.info('Setting Spain NUTS configuration') + spain.write({ + 'state_label': 'Province', + 'substate_label': 'Autonomous Community', + 'region_label': 'Region', + 'state_level': 4, + 'substate_level': 3, + 'region_level': 2, + }) diff --git a/l10n_es_location_nuts/i18n/es.po b/l10n_es_location_nuts/i18n/es.po new file mode 100644 index 00000000000..fee47312a15 --- /dev/null +++ b/l10n_es_location_nuts/i18n/es.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_location_nuts +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-06-11 15:27+0000\n" +"PO-Revision-Date: 2015-06-11 15:27+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_es_location_nuts +#: code:addons/l10n_es_location_nuts/models/res_partner.py:40 +#, python-format +msgid "Autonomous Community" +msgstr "Comunidad autónoma" + +#. module: l10n_es_location_nuts +#: model:ir.model,name:l10n_es_location_nuts.model_nuts_import +msgid "Import NUTS items from European RAMON service" +msgstr "Importar regiones NUTS desde el servicio europeo RAMON" + +#. module: l10n_es_location_nuts +#: model:ir.model,name:l10n_es_location_nuts.model_res_partner +msgid "Partner" +msgstr "Empresa" + +#. module: l10n_es_location_nuts +#: code:addons/l10n_es_location_nuts/models/res_partner.py:39 +#, python-format +msgid "Region" +msgstr "Región" + diff --git a/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot b/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot new file mode 100644 index 00000000000..4704c6297fa --- /dev/null +++ b/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_location_nuts +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-06-11 15:27+0000\n" +"PO-Revision-Date: 2015-06-11 15:27+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_es_location_nuts +#: code:addons/l10n_es_location_nuts/models/res_partner.py:40 +#, python-format +msgid "Autonomous Community" +msgstr "" + +#. module: l10n_es_location_nuts +#: model:ir.model,name:l10n_es_location_nuts.model_nuts_import +msgid "Import NUTS items from European RAMON service" +msgstr "" + +#. module: l10n_es_location_nuts +#: model:ir.model,name:l10n_es_location_nuts.model_res_partner +msgid "Partner" +msgstr "" + +#. module: l10n_es_location_nuts +#: code:addons/l10n_es_location_nuts/models/res_partner.py:39 +#, python-format +msgid "Region" +msgstr "" + diff --git a/l10n_es_location_nuts/models/__init__.py b/l10n_es_location_nuts/models/__init__.py new file mode 100644 index 00000000000..4c0501040f0 --- /dev/null +++ b/l10n_es_location_nuts/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa +# © 2015 Antiun Ingenieria S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import res_partner diff --git a/l10n_es_location_nuts/models/res_partner.py b/l10n_es_location_nuts/models/res_partner.py new file mode 100644 index 00000000000..606704c0cb0 --- /dev/null +++ b/l10n_es_location_nuts/models/res_partner.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa +# © 2015 Antiun Ingenieria S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, api +from openerp.tools.translate import _ +from openerp.addons.base_location_nuts.models.res_partner \ + import dict_recursive_update + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + @api.one + @api.depends('country_id') + def _labels_get(self): + super(ResPartner, self)._labels_get() + if self.country_id.code == 'ES': + self.lbl_substate = _('Autonomous Community') + self.lbl_region = _('Region') + + @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.code == 'ES': + region_id = False + substate_id = False + nuts_state = self.env['res.partner.nuts'].search( + [('level', '=', 4), + ('state_id', '=', state.id)]) + if nuts_state: + substate = nuts_state[0].parent_id + if substate: + substate_id = substate.id + region_id = substate.parent_id.id + changes = { + 'domain': { + 'substate': [('country_id', '=', 'ES'), + ('level', '=', 3)], + 'region': [('country_id', '=', 'ES'), + ('level', '=', 2)], + }, + 'value': { + 'substate': substate_id, + 'region': region_id, + } + } + dict_recursive_update(result, changes) + return result + + @api.onchange('substate', 'region') + def onchange_substate_or_region(self): + result = super(ResPartner, self).onchange_substate_or_region() + if (self.state_id.country_id.code == 'ES' or + self.substate.country_id.code == 'ES' or + self.region.country_id.code == 'ES'): + changes = { + 'domain': { + 'substate': [('country_id', '=', 'ES'), + ('level', '=', 3)], + 'region': [('country_id', '=', 'ES'), + ('level', '=', 2)], + } + } + if self.substate.country_id.code == 'ES': + self.region = self.substate.parent_id + self.country_id = self.substate.country_id + if self.region.country_id.code == 'ES': + self.country_id = self.region.country_id + if self.state_id.country_id.code == 'ES': + self.country_id = self.state_id.country_id + + dict_recursive_update(result, changes) + return result diff --git a/l10n_es_location_nuts/static/description/icon.png b/l10n_es_location_nuts/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..232cf6fc48e5b59388db3cef7ddb10a647b4e68a GIT binary patch literal 6868 zcmV;_8Y|_AP)stT-8evI9 zK~#9!?VWdclvVb}KkxLG-bf=5S}4*~Y@h-*q`0Cetcrk&itbu|5E}@BvdCIk#btHT z#Z?v*1pyUMKm`}sg%w3==p`Yf_e_6(f4s?*%p|1DBr{~r^W@3QTkd=3J>ProIp>~p zu0X_Mkr1_8l7(JD2mm1p0U$&n0E8$6fDpAmQg}UD`ndad!!saHt-lr5>mwF7|C+|! zQ@3x;p}Nl(EnxW{SbhQ9Sr97$8weT@qClPq^3I^>1@gFd0D!t=TnqZgFU}!gI}26s zgFWB#oLD9O*|Wj2yJ_IPr~qI+1lGf#=+X8)ZioR*l`{4csC-LeGDyEqH5BAYAcRTB zZ6}=4fs4;&qGjj;QG}sdYfcGm5pdRKT1vY|cx=1u27p1m(B~-5h>oLhJY}bAO4=FGl%-cY$ z0I?iQTR?Mb@c(-C2(at}On?>4KS+PbL6!)LGzlb%J|L*tsRRHJ)S$k}MG9;IdwKBx zdU*#hJOQ$#y3PTxp9S;3q3Q!DdjU+FLA1A1005|lfDl=W0BI@+HgTu2BFO77QQi>@ z&w=hS9=cBnvUo3dR!e4Z^)e7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S znw>bxD{L%Ynu|&$W7nPvI(1Yt=H@8UJ83w4RMO7B`nDv*-HQzX08hMdlCp9er_Va$ z@bU|-?AlWq;%0jQz`ldkA+EItKR}2=5+Eojn+T7D%eEkcUWUaYqErf~RWbxY(v?hg z_9xE9z20!UN)HbRkt_56`ax>4iZj`b%T)+X0j*4}v3S&2=7#_fBK{vxlZ@vmi|ADV O0000 Date: Mon, 28 Dec 2015 18:30:37 +0100 Subject: [PATCH 02/19] Give toponyms wizard the right priority. This will make it be executed before the NUTS import wizard. See https://github.com/OCA/l10n-spain/pull/150#issuecomment-148313801 --- l10n_es_location_nuts/README.rst | 9 ++- l10n_es_location_nuts/i18n/es.po | 23 ++----- .../i18n/l10n_es_location_nuts.pot | 39 ----------- l10n_es_location_nuts/models/res_partner.py | 64 +++---------------- 4 files changed, 22 insertions(+), 113 deletions(-) delete mode 100644 l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst index f4cb4441c62..d8ec03cc03a 100644 --- a/l10n_es_location_nuts/README.rst +++ b/l10n_es_location_nuts/README.rst @@ -48,14 +48,17 @@ Créditos Contribudores ------------- + * Antonio Espinosa +* Rafael Blasco +* Jairo Llopis Mantenido por ------------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org Este módulo lo mantiene la OCA. @@ -63,4 +66,4 @@ OCA (Odoo Community Association) es una organización sin ánimo de lucro cuya misión es mantener el desarrollo colaborativo de funcionalidad de Odoo y promocionar su uso por todo el mundo. -Para contribuir a éste módulo, por favor visita http://odoo-community.org +Para contribuir a éste módulo, por favor visita https://odoo-community.org diff --git a/l10n_es_location_nuts/i18n/es.po b/l10n_es_location_nuts/i18n/es.po index fee47312a15..b42b86af366 100644 --- a/l10n_es_location_nuts/i18n/es.po +++ b/l10n_es_location_nuts/i18n/es.po @@ -1,25 +1,21 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * l10n_es_location_nuts +# * l10n_es_location_nuts # msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-11 15:27+0000\n" -"PO-Revision-Date: 2015-06-11 15:27+0000\n" +"POT-Creation-Date: 2015-12-30 17:05+0100\n" +"PO-Revision-Date: 2015-12-30 17:05+0100\n" "Last-Translator: <>\n" "Language-Team: \n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" +"Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" - -#. module: l10n_es_location_nuts -#: code:addons/l10n_es_location_nuts/models/res_partner.py:40 -#, python-format -msgid "Autonomous Community" -msgstr "Comunidad autónoma" +"X-Generator: Poedit 1.8.5\n" #. module: l10n_es_location_nuts #: model:ir.model,name:l10n_es_location_nuts.model_nuts_import @@ -30,10 +26,3 @@ msgstr "Importar regiones NUTS desde el servicio europeo RAMON" #: model:ir.model,name:l10n_es_location_nuts.model_res_partner msgid "Partner" msgstr "Empresa" - -#. module: l10n_es_location_nuts -#: code:addons/l10n_es_location_nuts/models/res_partner.py:39 -#, python-format -msgid "Region" -msgstr "Región" - diff --git a/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot b/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot deleted file mode 100644 index 4704c6297fa..00000000000 --- a/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot +++ /dev/null @@ -1,39 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * l10n_es_location_nuts -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-11 15:27+0000\n" -"PO-Revision-Date: 2015-06-11 15:27+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_es_location_nuts -#: code:addons/l10n_es_location_nuts/models/res_partner.py:40 -#, python-format -msgid "Autonomous Community" -msgstr "" - -#. module: l10n_es_location_nuts -#: model:ir.model,name:l10n_es_location_nuts.model_nuts_import -msgid "Import NUTS items from European RAMON service" -msgstr "" - -#. module: l10n_es_location_nuts -#: model:ir.model,name:l10n_es_location_nuts.model_res_partner -msgid "Partner" -msgstr "" - -#. module: l10n_es_location_nuts -#: code:addons/l10n_es_location_nuts/models/res_partner.py:39 -#, python-format -msgid "Region" -msgstr "" - diff --git a/l10n_es_location_nuts/models/res_partner.py b/l10n_es_location_nuts/models/res_partner.py index 606704c0cb0..f5515f20210 100644 --- a/l10n_es_location_nuts/models/res_partner.py +++ b/l10n_es_location_nuts/models/res_partner.py @@ -4,73 +4,29 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api -from openerp.tools.translate import _ -from openerp.addons.base_location_nuts.models.res_partner \ - import dict_recursive_update class ResPartner(models.Model): _inherit = 'res.partner' - @api.one - @api.depends('country_id') - def _labels_get(self): - super(ResPartner, self)._labels_get() - if self.country_id.code == 'ES': - self.lbl_substate = _('Autonomous Community') - self.lbl_region = _('Region') - @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) + + # Ignore non-Spanish states if state.country_id.code == 'ES': - region_id = False - substate_id = False nuts_state = self.env['res.partner.nuts'].search( [('level', '=', 4), - ('state_id', '=', state.id)]) + ('state_id', '=', state.id)], + limit=1) + + # Update substate and region if nuts_state: - substate = nuts_state[0].parent_id + substate = nuts_state.parent_id if substate: - substate_id = substate.id - region_id = substate.parent_id.id - changes = { - 'domain': { - 'substate': [('country_id', '=', 'ES'), - ('level', '=', 3)], - 'region': [('country_id', '=', 'ES'), - ('level', '=', 2)], - }, - 'value': { - 'substate': substate_id, - 'region': region_id, - } - } - dict_recursive_update(result, changes) - return result - - @api.onchange('substate', 'region') - def onchange_substate_or_region(self): - result = super(ResPartner, self).onchange_substate_or_region() - if (self.state_id.country_id.code == 'ES' or - self.substate.country_id.code == 'ES' or - self.region.country_id.code == 'ES'): - changes = { - 'domain': { - 'substate': [('country_id', '=', 'ES'), - ('level', '=', 3)], - 'region': [('country_id', '=', 'ES'), - ('level', '=', 2)], - } - } - if self.substate.country_id.code == 'ES': - self.region = self.substate.parent_id - self.country_id = self.substate.country_id - if self.region.country_id.code == 'ES': - self.country_id = self.region.country_id - if self.state_id.country_id.code == 'ES': - self.country_id = self.state_id.country_id + result.setdefault("value", dict()) + result["value"]["substate_id"] = substate.id + result["value"]["region_id"] = substate.parent_id.id - dict_recursive_update(result, changes) return result From a97daba75d791f0532caf825cb5f7bbea59103da Mon Sep 17 00:00:00 2001 From: Antonio Espinosa Date: Fri, 29 Jan 2016 23:00:12 +0100 Subject: [PATCH 03/19] Complete spanish translation --- l10n_es_location_nuts/README.rst | 12 +++++++++--- l10n_es_location_nuts/i18n/es.po | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst index d8ec03cc03a..ce3ee3edb62 100644 --- a/l10n_es_location_nuts/README.rst +++ b/l10n_es_location_nuts/README.rst @@ -1,6 +1,8 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +========================= Regiones NUTS para España ========================= @@ -17,7 +19,7 @@ Este módulo permite importar las regiones NUTS para España. Instalación =========== -Para instalar éste addon, necesitarás el módulo python 'request': +Para instalar éste addon, necesitarás el módulo python 'requests': * pip intall requests @@ -36,12 +38,16 @@ provincias españolas definidas en el módulo l10n_es_toponyms Uso -===== +=== Sólo el administrador puede gestionar las regiones NUTS (realmente no es necesario porque es una convención a nivel Europeo) pero cualquier usuario puede leerlas, para que pueda asignarlas en eel objeto Empresa (res.partner) +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/189/8.0 + Créditos ======== diff --git a/l10n_es_location_nuts/i18n/es.po b/l10n_es_location_nuts/i18n/es.po index b42b86af366..27b514a5f07 100644 --- a/l10n_es_location_nuts/i18n/es.po +++ b/l10n_es_location_nuts/i18n/es.po @@ -26,3 +26,18 @@ msgstr "Importar regiones NUTS desde el servicio europeo RAMON" #: model:ir.model,name:l10n_es_location_nuts.model_res_partner msgid "Partner" msgstr "Empresa" + +#. module: l10n_es_location_nuts +#: model:res.country,substate_label:base.es +msgid "Autonomous Community" +msgstr "Comunidad autónoma" + +#. module: l10n_es_location_nuts +#: model:res.country,state_label:base.es +msgid "Province" +msgstr "Provincia" + +#. module: l10n_es_location_nuts +#: model:res.country,region_label:base.es +msgid "Region" +msgstr "Región" From b51c29c30928c3e96a64ad9915112b58604a81f9 Mon Sep 17 00:00:00 2001 From: Antonio Espinosa Date: Mon, 1 Feb 2016 17:59:53 +0100 Subject: [PATCH 04/19] Use separate and explicit fields for each NUTS level --- l10n_es_location_nuts/README.rst | 52 ++++++++------------- l10n_es_location_nuts/__init__.py | 1 - l10n_es_location_nuts/hooks.py | 5 -- l10n_es_location_nuts/i18n/es.po | 20 -------- l10n_es_location_nuts/models/__init__.py | 6 --- l10n_es_location_nuts/models/res_partner.py | 32 ------------- 6 files changed, 20 insertions(+), 96 deletions(-) delete mode 100644 l10n_es_location_nuts/models/__init__.py delete mode 100644 l10n_es_location_nuts/models/res_partner.py diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst index ce3ee3edb62..04097c8a5b0 100644 --- a/l10n_es_location_nuts/README.rst +++ b/l10n_es_location_nuts/README.rst @@ -6,22 +6,8 @@ Regiones NUTS para España ========================= -Este módulo permite importar las regiones NUTS para España. - -* Provincias españolas (NUTS level 4) como Provincia en el formulario de Empresa - (res.partner.state_id) -* Comunidades autónomas españolas (NUTS level 3) como Comunidad Autónoma en el - formulario de Empresa (res.partner.substate) -* Regiones españolas (NUTS level 2) como Regiones en el formulario de Empresa - (res.partner.region) - - -Instalación -=========== - -Para instalar éste addon, necesitarás el módulo python 'requests': - -* pip intall requests +Este módulo permite relacionar las regiones NUTS para España de nivel 4 +con las provincias españolas. Configuración @@ -31,10 +17,11 @@ Después de instalar, debes clicar en el asistente de importación para añadir las regiones NUTS en la base de datos de Odoo. Ventas > Configuración > Libreta de direcciones > Importar NUTS 2013 -Este asistente descargará del servicio europeo RAMON los metadatos para añadir -las regiones NUTS en Odoo. Este módulo específico de la localización española -hereda este asistente genérico para relacionar cada region NUTS española con las -provincias españolas definidas en el módulo l10n_es_toponyms +Este asistente descargará del servicio europeo RAMON (Reference And Management Of Nomenclatures) +los metadatos para añadir las regiones NUTS en Odoo. Este módulo específico +de la localización española hereda este asistente genérico para relacionar +cada region NUTS española con las provincias españolas definidas en el +módulo l10n_es_toponyms Uso @@ -42,7 +29,7 @@ Uso Sólo el administrador puede gestionar las regiones NUTS (realmente no es necesario porque es una convención a nivel Europeo) pero cualquier usuario puede leerlas, -para que pueda asignarlas en eel objeto Empresa (res.partner) +para que pueda asignarlas en el objeto Empresa (res.partner) .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot @@ -52,24 +39,25 @@ para que pueda asignarlas en eel objeto Empresa (res.partner) Créditos ======== -Contribudores -------------- +Contribuidores +-------------- * Antonio Espinosa * Rafael Blasco * Jairo Llopis -Mantenido por -------------- +Maintainer +---------- -.. image:: https://odoo-community.org/logo.png +.. image:: http://odoo-community.org/logo.png :alt: Odoo Community Association - :target: https://odoo-community.org + :target: http://odoo-community.org + +This module is maintained by the OCA. -Este módulo lo mantiene la 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. -OCA (Odoo Community Association) es una organización sin ánimo de lucro cuya -misión es mantener el desarrollo colaborativo de funcionalidad de Odoo -y promocionar su uso por todo el mundo. +To contribute to this module, please visit http://odoo-community.org. -Para contribuir a éste módulo, por favor visita https://odoo-community.org diff --git a/l10n_es_location_nuts/__init__.py b/l10n_es_location_nuts/__init__.py index 50d66b61394..e6746f83edd 100644 --- a/l10n_es_location_nuts/__init__.py +++ b/l10n_es_location_nuts/__init__.py @@ -3,6 +3,5 @@ # © 2015 Antiun Ingenieria S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import models from . import wizard from .hooks import post_init_hook diff --git a/l10n_es_location_nuts/hooks.py b/l10n_es_location_nuts/hooks.py index 969ce7d359c..f563ef1bb27 100644 --- a/l10n_es_location_nuts/hooks.py +++ b/l10n_es_location_nuts/hooks.py @@ -16,10 +16,5 @@ def post_init_hook(cr, registry): spain = env.ref('base.es') _logger.info('Setting Spain NUTS configuration') spain.write({ - 'state_label': 'Province', - 'substate_label': 'Autonomous Community', - 'region_label': 'Region', 'state_level': 4, - 'substate_level': 3, - 'region_level': 2, }) diff --git a/l10n_es_location_nuts/i18n/es.po b/l10n_es_location_nuts/i18n/es.po index 27b514a5f07..3b52deb99ff 100644 --- a/l10n_es_location_nuts/i18n/es.po +++ b/l10n_es_location_nuts/i18n/es.po @@ -21,23 +21,3 @@ msgstr "" #: model:ir.model,name:l10n_es_location_nuts.model_nuts_import msgid "Import NUTS items from European RAMON service" msgstr "Importar regiones NUTS desde el servicio europeo RAMON" - -#. module: l10n_es_location_nuts -#: model:ir.model,name:l10n_es_location_nuts.model_res_partner -msgid "Partner" -msgstr "Empresa" - -#. module: l10n_es_location_nuts -#: model:res.country,substate_label:base.es -msgid "Autonomous Community" -msgstr "Comunidad autónoma" - -#. module: l10n_es_location_nuts -#: model:res.country,state_label:base.es -msgid "Province" -msgstr "Provincia" - -#. module: l10n_es_location_nuts -#: model:res.country,region_label:base.es -msgid "Region" -msgstr "Región" diff --git a/l10n_es_location_nuts/models/__init__.py b/l10n_es_location_nuts/models/__init__.py deleted file mode 100644 index 4c0501040f0..00000000000 --- a/l10n_es_location_nuts/models/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa -# © 2015 Antiun Ingenieria S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import res_partner diff --git a/l10n_es_location_nuts/models/res_partner.py b/l10n_es_location_nuts/models/res_partner.py deleted file mode 100644 index f5515f20210..00000000000 --- a/l10n_es_location_nuts/models/res_partner.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa -# © 2015 Antiun Ingenieria S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp import models, api - - -class ResPartner(models.Model): - _inherit = 'res.partner' - - @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) - - # Ignore non-Spanish states - if state.country_id.code == 'ES': - nuts_state = self.env['res.partner.nuts'].search( - [('level', '=', 4), - ('state_id', '=', state.id)], - limit=1) - - # Update substate and region - if nuts_state: - substate = nuts_state.parent_id - if substate: - result.setdefault("value", dict()) - result["value"]["substate_id"] = substate.id - result["value"]["region_id"] = substate.parent_id.id - - return result From d0f608c6b88f05db1259cfa9b53326b6626b265f Mon Sep 17 00:00:00 2001 From: David Vidal Date: Fri, 23 Jun 2017 18:38:32 +0200 Subject: [PATCH 05/19] [MIG] l10n_es_location_nuts: Migration to 10.0 --- l10n_es_location_nuts/README.rst | 40 +++--- l10n_es_location_nuts/__init__.py | 3 - .../{__openerp__.py => __manifest__.py} | 13 +- l10n_es_location_nuts/hooks.py | 2 +- l10n_es_location_nuts/wizard/__init__.py | 3 - l10n_es_location_nuts/wizard/nuts_import.py | 125 +++++++++--------- 6 files changed, 89 insertions(+), 97 deletions(-) rename l10n_es_location_nuts/{__openerp__.py => __manifest__.py} (65%) diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst index 04097c8a5b0..6fa1eb3837b 100644 --- a/l10n_es_location_nuts/README.rst +++ b/l10n_es_location_nuts/README.rst @@ -6,35 +6,33 @@ Regiones NUTS para España ========================= -Este módulo permite relacionar las regiones NUTS para España de nivel 4 -con las provincias españolas. - +Este módulo permite relacionar las regiones NUTS para España de nivel 4 con las +provincias españolas. Configuración ============= Después de instalar, debes clicar en el asistente de importación para añadir las regiones NUTS en la base de datos de Odoo. -Ventas > Configuración > Libreta de direcciones > Importar NUTS 2013 -Este asistente descargará del servicio europeo RAMON (Reference And Management Of Nomenclatures) -los metadatos para añadir las regiones NUTS en Odoo. Este módulo específico -de la localización española hereda este asistente genérico para relacionar -cada region NUTS española con las provincias españolas definidas en el -módulo l10n_es_toponyms +Ventas > Configuración > Libreta de direcciones > Importar NUTS 2013 +Este asistente descargará del servicio europeo RAMON (Reference And Management +Of Nomenclatures) los metadatos para añadir las regiones NUTS en Odoo. Este +módulo específico de la localización española hereda este asistente genérico +para relacionar cada region NUTS española con las provincias españolas +definidas en Odoo. Uso === -Sólo el administrador puede gestionar las regiones NUTS (realmente no es necesario -porque es una convención a nivel Europeo) pero cualquier usuario puede leerlas, -para que pueda asignarlas en el objeto Empresa (res.partner) +Sólo el administrador puede gestionar las regiones NUTS (realmente no es +necesario porque es una convención a nivel Europeo) pero cualquier usuario +puede leerlas, para que pueda asignarlas en el objeto Empresa (res.partner) .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/189/8.0 - + :target: https://runbot.odoo-community.org/runbot/189/10.0 Créditos ======== @@ -42,16 +40,17 @@ Créditos Contribuidores -------------- -* Antonio Espinosa -* Rafael Blasco -* Jairo Llopis +* Antonio Espinosa +* Rafael Blasco +* Jairo Llopis +* David Vidal Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. @@ -59,5 +58,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. diff --git a/l10n_es_location_nuts/__init__.py b/l10n_es_location_nuts/__init__.py index e6746f83edd..c61330a4d4f 100644 --- a/l10n_es_location_nuts/__init__.py +++ b/l10n_es_location_nuts/__init__.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa -# © 2015 Antiun Ingenieria S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import wizard from .hooks import post_init_hook diff --git a/l10n_es_location_nuts/__openerp__.py b/l10n_es_location_nuts/__manifest__.py similarity index 65% rename from l10n_es_location_nuts/__openerp__.py rename to l10n_es_location_nuts/__manifest__.py index facc6a24b5e..c6f898c25e9 100644 --- a/l10n_es_location_nuts/__openerp__.py +++ b/l10n_es_location_nuts/__manifest__.py @@ -1,22 +1,21 @@ # -*- coding: utf-8 -*- -# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa -# © 2015 Antiun Ingenieria S.L. - Jairo Llopis +# Copyright 2015 Tecnativa - Antonio Espinosa +# Copyright 2015 Tecnativa - Jairo Llopis +# Copyright 2017 Tecnativa - David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - { 'name': 'NUTS Regions for Spain', 'summary': 'NUTS specific options for Spain', - 'version': '8.0.1.0.0', + 'version': '10.0.1.0.0', 'category': 'Localisation/Europe', - 'website': 'http://www.antiun.com', - 'author': 'Antiun Ingeniería S.L., ' + 'website': 'https://www.tecnativa.com', + 'author': 'Tecnativa, ' 'Odoo Community Association (OCA)', 'license': 'AGPL-3', 'application': False, 'installable': True, 'depends': [ 'base_location_nuts', - 'l10n_es_toponyms', ], 'post_init_hook': 'post_init_hook', } diff --git a/l10n_es_location_nuts/hooks.py b/l10n_es_location_nuts/hooks.py index f563ef1bb27..7b609ab17d5 100644 --- a/l10n_es_location_nuts/hooks.py +++ b/l10n_es_location_nuts/hooks.py @@ -3,7 +3,7 @@ # © 2015 Antiun Ingenieria S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import api, SUPERUSER_ID +from odoo import api, SUPERUSER_ID import logging _logger = logging.getLogger(__name__) diff --git a/l10n_es_location_nuts/wizard/__init__.py b/l10n_es_location_nuts/wizard/__init__.py index 134d83696ae..b5a60faa369 100644 --- a/l10n_es_location_nuts/wizard/__init__.py +++ b/l10n_es_location_nuts/wizard/__init__.py @@ -1,6 +1,3 @@ # -*- coding: utf-8 -*- -# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa -# © 2015 Antiun Ingenieria S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import nuts_import diff --git a/l10n_es_location_nuts/wizard/nuts_import.py b/l10n_es_location_nuts/wizard/nuts_import.py index 7018321f78b..e3c2d5fac10 100644 --- a/l10n_es_location_nuts/wizard/nuts_import.py +++ b/l10n_es_location_nuts/wizard/nuts_import.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- -# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa -# © 2015 Antiun Ingenieria S.L. - Jairo Llopis +# Copyright 2015 Tecnativa - Antonio Espinosa +# Copyright 2015 Tecnativa - Jairo Llopis +# Copyright 2017 Tecnativa - David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, api +from odoo import api, models import logging logger = logging.getLogger(__name__) @@ -12,65 +13,65 @@ class NutsImport(models.TransientModel): _inherit = 'nuts.import' _es_state_map = { - 'ES111': 'l10n_es_toponyms.ES15', # A Coruña - 'ES112': 'l10n_es_toponyms.ES27', # Lugo - 'ES113': 'l10n_es_toponyms.ES32', # Ourense - 'ES114': 'l10n_es_toponyms.ES36', # Pontevedra - 'ES120': 'l10n_es_toponyms.ES33', # Asturias - 'ES130': 'l10n_es_toponyms.ES39', # Cantabria - 'ES211': 'l10n_es_toponyms.ES01', # Araba/Álava - 'ES212': 'l10n_es_toponyms.ES20', # Gipuzkoa - 'ES213': 'l10n_es_toponyms.ES48', # Bizkaia - 'ES220': 'l10n_es_toponyms.ES31', # Navarra - 'ES230': 'l10n_es_toponyms.ES26', # La Rioja - 'ES241': 'l10n_es_toponyms.ES22', # Huesca - 'ES242': 'l10n_es_toponyms.ES44', # Teruel - 'ES243': 'l10n_es_toponyms.ES50', # Zaragoza - 'ES300': 'l10n_es_toponyms.ES28', # Madrid - 'ES411': 'l10n_es_toponyms.ES05', # Ávila - 'ES412': 'l10n_es_toponyms.ES09', # Burgos - 'ES413': 'l10n_es_toponyms.ES24', # León - 'ES414': 'l10n_es_toponyms.ES34', # Palencia - 'ES415': 'l10n_es_toponyms.ES37', # Salamanca - 'ES416': 'l10n_es_toponyms.ES40', # Segovia - 'ES417': 'l10n_es_toponyms.ES42', # Soria - 'ES418': 'l10n_es_toponyms.ES47', # Valladolid - 'ES419': 'l10n_es_toponyms.ES49', # Zamora - 'ES421': 'l10n_es_toponyms.ES02', # Albacete - 'ES422': 'l10n_es_toponyms.ES13', # Ciudad Real - 'ES423': 'l10n_es_toponyms.ES16', # Cuenca - 'ES424': 'l10n_es_toponyms.ES19', # Guadalajara - 'ES425': 'l10n_es_toponyms.ES45', # Toledo - 'ES431': 'l10n_es_toponyms.ES06', # Badajoz - 'ES432': 'l10n_es_toponyms.ES10', # Cáceres - 'ES511': 'l10n_es_toponyms.ES08', # Barcelona - 'ES512': 'l10n_es_toponyms.ES17', # Girona - 'ES513': 'l10n_es_toponyms.ES25', # Lleida - 'ES514': 'l10n_es_toponyms.ES43', # Tarragona - 'ES521': 'l10n_es_toponyms.ES03', # Alicante / Alacant - 'ES522': 'l10n_es_toponyms.ES12', # Castellón / Castelló - 'ES523': 'l10n_es_toponyms.ES46', # Valencia / València - 'ES531': 'l10n_es_toponyms.ES07', # Eivissa y Formentera - 'ES532': 'l10n_es_toponyms.ES07', # Mallorca - 'ES533': 'l10n_es_toponyms.ES07', # Menorca - 'ES611': 'l10n_es_toponyms.ES04', # Almería - 'ES612': 'l10n_es_toponyms.ES11', # Cádiz - 'ES613': 'l10n_es_toponyms.ES14', # Córdoba - 'ES614': 'l10n_es_toponyms.ES18', # Granada - 'ES615': 'l10n_es_toponyms.ES21', # Huelva - 'ES616': 'l10n_es_toponyms.ES23', # Jaén - 'ES617': 'l10n_es_toponyms.ES29', # Málaga - 'ES618': 'l10n_es_toponyms.ES41', # Sevilla - 'ES620': 'l10n_es_toponyms.ES30', # Murcia - 'ES630': 'l10n_es_toponyms.ES51', # Ceuta - 'ES640': 'l10n_es_toponyms.ES52', # Melilla - 'ES703': 'l10n_es_toponyms.ES38', # El Hierro - 'ES704': 'l10n_es_toponyms.ES35', # Fuerteventura - 'ES705': 'l10n_es_toponyms.ES35', # Gran Canaria - 'ES706': 'l10n_es_toponyms.ES38', # La Gomera - 'ES707': 'l10n_es_toponyms.ES38', # La Palma - 'ES708': 'l10n_es_toponyms.ES35', # Lanzarote - 'ES709': 'l10n_es_toponyms.ES38', # Tenerife + 'ES111': 'base.state_es_c', # A Coruña + 'ES421': 'base.state_es_ab', # Albacete + 'ES521': 'base.state_es_a', # Alicante / Alacant + 'ES611': 'base.state_es_al', # Almería + 'ES211': 'base.state_es_vi', # Araba/Álava + 'ES120': 'base.state_es_o', # Asturias + 'ES411': 'base.state_es_av', # Ávila + 'ES431': 'base.state_es_ba', # Badajoz + 'ES511': 'base.state_es_b', # Barcelona + 'ES213': 'base.state_es_bi', # Bizkaia + 'ES412': 'base.state_es_bu', # Burgo + 'ES432': 'base.state_es_cc', # Cáceres + 'ES612': 'base.state_es_ca', # Cádiz + 'ES130': 'base.state_es_s', # Cantabria + 'ES522': 'base.state_es_cs', # Castellón / Castelló + 'ES630': 'base.state_es_ce', # Ceuta + 'ES422': 'base.state_es_cr', # Ciudad Real + 'ES613': 'base.state_es_co', # Córdoba + 'ES423': 'base.state_es_cu', # Cuenca + 'ES531': 'base.state_es_pm', # Eivissa y Formentera + 'ES703': 'base.state_es_tf', # El Hierro + 'ES704': 'base.state_es_gc', # Fuerteventura + 'ES212': 'base.state_es_ss', # Gipuzkoa + 'ES512': 'base.state_es_gi', # Girona + 'ES705': 'base.state_es_gc', # Gran Canaria + 'ES614': 'base.state_es_gr', # Granada + 'ES424': 'base.state_es_gu', # Guadalajara + 'ES615': 'base.state_es_h', # Huelva + 'ES241': 'base.state_es_hu', # Huesca + 'ES616': 'base.state_es_j', # Jaén + 'ES706': 'base.state_es_tf', # La Gomera + 'ES707': 'base.state_es_tf', # La Palma + 'ES230': 'base.state_es_lo', # La Rioja + 'ES708': 'base.state_es_gc', # Lanzarote + 'ES413': 'base.state_es_le', # León + 'ES513': 'base.state_es_l', # Lleida + 'ES112': 'base.state_es_lu', # Lugo + 'ES300': 'base.state_es_m', # Madrid + 'ES617': 'base.state_es_ma', # Málaga + 'ES532': 'base.state_es_pm', # Mallorca + 'ES640': 'base.state_es_ml', # Melilla + 'ES533': 'base.state_es_ba', # Menorca + 'ES620': 'base.state_es_mu', # Murcia + 'ES220': 'base.state_es_na', # Navarra + 'ES113': 'base.state_es_or', # Ourense + 'ES414': 'base.state_es_p', # Palencia + 'ES114': 'base.state_es_po', # Pontevedra + 'ES415': 'base.state_es_sa', # Salamanca + 'ES416': 'base.state_es_sg', # Segovia + 'ES618': 'base.state_es_se', # Sevilla + 'ES417': 'base.state_es_so', # Soria + 'ES514': 'base.state_es_t', # Tarragona + 'ES709': 'base.state_es_tf', # Tenerife + 'ES242': 'base.state_es_te', # Teruel + 'ES425': 'base.state_es_to', # Toledo + 'ES523': 'base.state_es_v', # Valencia / València + 'ES418': 'base.state_es_va', # Valladolid + 'ES419': 'base.state_es_za', # Zamora + 'ES243': 'base.state_es_z', # Zaragoza 'ESZZZ': False, # Extra-Regio NUTS 3 } From ccc6b23e1a67ec6e18a9a0cc228fa2e47f7e3ff7 Mon Sep 17 00:00:00 2001 From: agaldona Date: Tue, 14 Nov 2017 12:23:39 +0100 Subject: [PATCH 06/19] [MIG] l10n_es_location_nuts: Migration to 11.0 --- l10n_es_location_nuts/README.rst | 2 +- l10n_es_location_nuts/__init__.py | 2 -- l10n_es_location_nuts/__manifest__.py | 5 ++--- l10n_es_location_nuts/hooks.py | 1 - .../i18n/l10n_es_location_nuts.pot | 20 +++++++++++++++++++ l10n_es_location_nuts/wizard/__init__.py | 2 -- l10n_es_location_nuts/wizard/nuts_import.py | 1 - 7 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst index 6fa1eb3837b..43643659e92 100644 --- a/l10n_es_location_nuts/README.rst +++ b/l10n_es_location_nuts/README.rst @@ -32,7 +32,7 @@ puede leerlas, para que pueda asignarlas en el objeto Empresa (res.partner) .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/189/10.0 + :target: https://runbot.odoo-community.org/runbot/189/11.0 Créditos ======== diff --git a/l10n_es_location_nuts/__init__.py b/l10n_es_location_nuts/__init__.py index c61330a4d4f..5226545ea26 100644 --- a/l10n_es_location_nuts/__init__.py +++ b/l10n_es_location_nuts/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- - from . import wizard from .hooks import post_init_hook diff --git a/l10n_es_location_nuts/__manifest__.py b/l10n_es_location_nuts/__manifest__.py index c6f898c25e9..604ab325746 100644 --- a/l10n_es_location_nuts/__manifest__.py +++ b/l10n_es_location_nuts/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015 Tecnativa - Antonio Espinosa # Copyright 2015 Tecnativa - Jairo Llopis # Copyright 2017 Tecnativa - David Vidal @@ -6,9 +5,9 @@ { 'name': 'NUTS Regions for Spain', 'summary': 'NUTS specific options for Spain', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'Localisation/Europe', - 'website': 'https://www.tecnativa.com', + 'website': 'https://github.com/OCA/l10n-spain', 'author': 'Tecnativa, ' 'Odoo Community Association (OCA)', 'license': 'AGPL-3', diff --git a/l10n_es_location_nuts/hooks.py b/l10n_es_location_nuts/hooks.py index 7b609ab17d5..9bce7517614 100644 --- a/l10n_es_location_nuts/hooks.py +++ b/l10n_es_location_nuts/hooks.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2015 Antiun Ingenieria S.L. - Antonio Espinosa # © 2015 Antiun Ingenieria S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot b/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot new file mode 100644 index 00000000000..6ca266ff5e6 --- /dev/null +++ b/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_location_nuts +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \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_es_location_nuts +#: model:ir.model,name:l10n_es_location_nuts.model_nuts_import +msgid "Import NUTS items from European RAMON service" +msgstr "" + diff --git a/l10n_es_location_nuts/wizard/__init__.py b/l10n_es_location_nuts/wizard/__init__.py index b5a60faa369..d6a5945e6b1 100644 --- a/l10n_es_location_nuts/wizard/__init__.py +++ b/l10n_es_location_nuts/wizard/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import nuts_import diff --git a/l10n_es_location_nuts/wizard/nuts_import.py b/l10n_es_location_nuts/wizard/nuts_import.py index e3c2d5fac10..2aaa2d6ccf6 100644 --- a/l10n_es_location_nuts/wizard/nuts_import.py +++ b/l10n_es_location_nuts/wizard/nuts_import.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015 Tecnativa - Antonio Espinosa # Copyright 2015 Tecnativa - Jairo Llopis # Copyright 2017 Tecnativa - David Vidal From 4ea8677eb6f8252b7a66f62227e1882fac251de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=C3=ADaz?= Date: Wed, 15 May 2019 17:17:57 +0200 Subject: [PATCH 07/19] [MIG] l10n_es_location_nuts: Migration to 12.0 --- l10n_es_location_nuts/README.rst | 78 ++- l10n_es_location_nuts/__manifest__.py | 2 +- .../i18n/l10n_es_location_nuts.pot | 2 +- l10n_es_location_nuts/readme/CONFIGURE.rst | 10 + l10n_es_location_nuts/readme/CONTRIBUTORS.rst | 5 + l10n_es_location_nuts/readme/DESCRIPTION.rst | 2 + l10n_es_location_nuts/readme/USAGE.rst | 3 + .../static/description/index.html | 443 ++++++++++++++++++ 8 files changed, 523 insertions(+), 22 deletions(-) create mode 100644 l10n_es_location_nuts/readme/CONFIGURE.rst create mode 100644 l10n_es_location_nuts/readme/CONTRIBUTORS.rst create mode 100644 l10n_es_location_nuts/readme/DESCRIPTION.rst create mode 100644 l10n_es_location_nuts/readme/USAGE.rst create mode 100644 l10n_es_location_nuts/static/description/index.html diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst index 43643659e92..5c324dfa328 100644 --- a/l10n_es_location_nuts/README.rst +++ b/l10n_es_location_nuts/README.rst @@ -1,15 +1,39 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg +====================== +NUTS Regions for Spain +====================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 - -========================= -Regiones NUTS para España -========================= +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-spain/tree/12.0/l10n_es_location_nuts + :alt: OCA/l10n-spain +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-spain-12-0/l10n-spain-12-0-l10n_es_location_nuts + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/189/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| Este módulo permite relacionar las regiones NUTS para España de nivel 4 con las provincias españolas. -Configuración +**Table of contents** + +.. contents:: + :local: + +Configuration ============= Después de instalar, debes clicar en el asistente de importación para añadir @@ -23,39 +47,53 @@ módulo específico de la localización española hereda este asistente genéric para relacionar cada region NUTS española con las provincias españolas definidas en Odoo. -Uso -=== +Usage +===== Sólo el administrador puede gestionar las regiones NUTS (realmente no es necesario porque es una convención a nivel Europeo) pero cualquier usuario puede leerlas, para que pueda asignarlas en el objeto Empresa (res.partner) -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/189/11.0 +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= -Créditos -======== +Authors +~~~~~~~ -Contribuidores --------------- +* Tecnativa + +Contributors +~~~~~~~~~~~~ * Antonio Espinosa * Rafael Blasco * Jairo Llopis * David Vidal +* Alexandre Díaz + +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +This module is maintained by the OCA. .. 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 module is part of the `OCA/l10n-spain `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_es_location_nuts/__manifest__.py b/l10n_es_location_nuts/__manifest__.py index 604ab325746..b9a65d96144 100644 --- a/l10n_es_location_nuts/__manifest__.py +++ b/l10n_es_location_nuts/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'NUTS Regions for Spain', 'summary': 'NUTS specific options for Spain', - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'category': 'Localisation/Europe', 'website': 'https://github.com/OCA/l10n-spain', 'author': 'Tecnativa, ' diff --git a/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot b/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot index 6ca266ff5e6..a9e013b76e5 100644 --- a/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot +++ b/l10n_es_location_nuts/i18n/l10n_es_location_nuts.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" diff --git a/l10n_es_location_nuts/readme/CONFIGURE.rst b/l10n_es_location_nuts/readme/CONFIGURE.rst new file mode 100644 index 00000000000..aea5a884de1 --- /dev/null +++ b/l10n_es_location_nuts/readme/CONFIGURE.rst @@ -0,0 +1,10 @@ +Después de instalar, debes clicar en el asistente de importación para añadir +las regiones NUTS en la base de datos de Odoo. + +Ventas > Configuración > Libreta de direcciones > Importar NUTS 2013 + +Este asistente descargará del servicio europeo RAMON (Reference And Management +Of Nomenclatures) los metadatos para añadir las regiones NUTS en Odoo. Este +módulo específico de la localización española hereda este asistente genérico +para relacionar cada region NUTS española con las provincias españolas +definidas en Odoo. diff --git a/l10n_es_location_nuts/readme/CONTRIBUTORS.rst b/l10n_es_location_nuts/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..e92a687e740 --- /dev/null +++ b/l10n_es_location_nuts/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* Antonio Espinosa +* Rafael Blasco +* Jairo Llopis +* David Vidal +* Alexandre Díaz diff --git a/l10n_es_location_nuts/readme/DESCRIPTION.rst b/l10n_es_location_nuts/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..752054d6f81 --- /dev/null +++ b/l10n_es_location_nuts/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Este módulo permite relacionar las regiones NUTS para España de nivel 4 con las +provincias españolas. diff --git a/l10n_es_location_nuts/readme/USAGE.rst b/l10n_es_location_nuts/readme/USAGE.rst new file mode 100644 index 00000000000..7324fd31f2e --- /dev/null +++ b/l10n_es_location_nuts/readme/USAGE.rst @@ -0,0 +1,3 @@ +Sólo el administrador puede gestionar las regiones NUTS (realmente no es +necesario porque es una convención a nivel Europeo) pero cualquier usuario +puede leerlas, para que pueda asignarlas en el objeto Empresa (res.partner) diff --git a/l10n_es_location_nuts/static/description/index.html b/l10n_es_location_nuts/static/description/index.html new file mode 100644 index 00000000000..763724d6c7c --- /dev/null +++ b/l10n_es_location_nuts/static/description/index.html @@ -0,0 +1,443 @@ + + + + + + +NUTS Regions for Spain + + + +
+

NUTS Regions for Spain

+ + +

Beta License: AGPL-3 OCA/l10n-spain Translate me on Weblate Try me on Runbot

+

Este módulo permite relacionar las regiones NUTS para España de nivel 4 con las +provincias españolas.

+

Table of contents

+ +
+

Configuration

+

Después de instalar, debes clicar en el asistente de importación para añadir +las regiones NUTS en la base de datos de Odoo.

+

Ventas > Configuración > Libreta de direcciones > Importar NUTS 2013

+

Este asistente descargará del servicio europeo RAMON (Reference And Management +Of Nomenclatures) los metadatos para añadir las regiones NUTS en Odoo. Este +módulo específico de la localización española hereda este asistente genérico +para relacionar cada region NUTS española con las provincias españolas +definidas en Odoo.

+
+
+

Usage

+

Sólo el administrador puede gestionar las regiones NUTS (realmente no es +necesario porque es una convención a nivel Europeo) pero cualquier usuario +puede leerlas, para que pueda asignarlas en el objeto Empresa (res.partner)

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/l10n-spain project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From 57aaafb707542113a24e3932a6e05624da305865 Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Thu, 20 Jan 2022 23:03:16 -0500 Subject: [PATCH 08/19] [IMP] l10n_es_location_nuts: black, isort, prettier --- l10n_es_location_nuts/__manifest__.py | 25 ++-- l10n_es_location_nuts/hooks.py | 15 ++- l10n_es_location_nuts/wizard/nuts_import.py | 133 ++++++++++---------- 3 files changed, 88 insertions(+), 85 deletions(-) diff --git a/l10n_es_location_nuts/__manifest__.py b/l10n_es_location_nuts/__manifest__.py index b9a65d96144..74b98c13409 100644 --- a/l10n_es_location_nuts/__manifest__.py +++ b/l10n_es_location_nuts/__manifest__.py @@ -3,18 +3,17 @@ # Copyright 2017 Tecnativa - David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - 'name': 'NUTS Regions for Spain', - 'summary': 'NUTS specific options for Spain', - 'version': '12.0.1.0.0', - 'category': 'Localisation/Europe', - 'website': 'https://github.com/OCA/l10n-spain', - 'author': 'Tecnativa, ' - 'Odoo Community Association (OCA)', - 'license': 'AGPL-3', - 'application': False, - 'installable': True, - 'depends': [ - 'base_location_nuts', + "name": "NUTS Regions for Spain", + "summary": "NUTS specific options for Spain", + "version": "12.0.1.0.0", + "category": "Localisation/Europe", + "website": "https://github.com/OCA/l10n-spain", + "author": "Tecnativa, " "Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "base_location_nuts", ], - 'post_init_hook': 'post_init_hook', + "post_init_hook": "post_init_hook", } diff --git a/l10n_es_location_nuts/hooks.py b/l10n_es_location_nuts/hooks.py index 9bce7517614..83cd16ccb1b 100644 --- a/l10n_es_location_nuts/hooks.py +++ b/l10n_es_location_nuts/hooks.py @@ -2,9 +2,10 @@ # © 2015 Antiun Ingenieria S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import api, SUPERUSER_ID import logging +from odoo import SUPERUSER_ID, api + _logger = logging.getLogger(__name__) @@ -12,8 +13,10 @@ def post_init_hook(cr, registry): """Define Spanish specific configuration in res.country.""" with api.Environment.manage(): env = api.Environment(cr, SUPERUSER_ID, {}) - spain = env.ref('base.es') - _logger.info('Setting Spain NUTS configuration') - spain.write({ - 'state_level': 4, - }) + spain = env.ref("base.es") + _logger.info("Setting Spain NUTS configuration") + spain.write( + { + "state_level": 4, + } + ) diff --git a/l10n_es_location_nuts/wizard/nuts_import.py b/l10n_es_location_nuts/wizard/nuts_import.py index 2aaa2d6ccf6..9b933a92ec9 100644 --- a/l10n_es_location_nuts/wizard/nuts_import.py +++ b/l10n_es_location_nuts/wizard/nuts_import.py @@ -3,86 +3,87 @@ # Copyright 2017 Tecnativa - David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import api, models import logging +from odoo import api, models + logger = logging.getLogger(__name__) class NutsImport(models.TransientModel): - _inherit = 'nuts.import' + _inherit = "nuts.import" _es_state_map = { - 'ES111': 'base.state_es_c', # A Coruña - 'ES421': 'base.state_es_ab', # Albacete - 'ES521': 'base.state_es_a', # Alicante / Alacant - 'ES611': 'base.state_es_al', # Almería - 'ES211': 'base.state_es_vi', # Araba/Álava - 'ES120': 'base.state_es_o', # Asturias - 'ES411': 'base.state_es_av', # Ávila - 'ES431': 'base.state_es_ba', # Badajoz - 'ES511': 'base.state_es_b', # Barcelona - 'ES213': 'base.state_es_bi', # Bizkaia - 'ES412': 'base.state_es_bu', # Burgo - 'ES432': 'base.state_es_cc', # Cáceres - 'ES612': 'base.state_es_ca', # Cádiz - 'ES130': 'base.state_es_s', # Cantabria - 'ES522': 'base.state_es_cs', # Castellón / Castelló - 'ES630': 'base.state_es_ce', # Ceuta - 'ES422': 'base.state_es_cr', # Ciudad Real - 'ES613': 'base.state_es_co', # Córdoba - 'ES423': 'base.state_es_cu', # Cuenca - 'ES531': 'base.state_es_pm', # Eivissa y Formentera - 'ES703': 'base.state_es_tf', # El Hierro - 'ES704': 'base.state_es_gc', # Fuerteventura - 'ES212': 'base.state_es_ss', # Gipuzkoa - 'ES512': 'base.state_es_gi', # Girona - 'ES705': 'base.state_es_gc', # Gran Canaria - 'ES614': 'base.state_es_gr', # Granada - 'ES424': 'base.state_es_gu', # Guadalajara - 'ES615': 'base.state_es_h', # Huelva - 'ES241': 'base.state_es_hu', # Huesca - 'ES616': 'base.state_es_j', # Jaén - 'ES706': 'base.state_es_tf', # La Gomera - 'ES707': 'base.state_es_tf', # La Palma - 'ES230': 'base.state_es_lo', # La Rioja - 'ES708': 'base.state_es_gc', # Lanzarote - 'ES413': 'base.state_es_le', # León - 'ES513': 'base.state_es_l', # Lleida - 'ES112': 'base.state_es_lu', # Lugo - 'ES300': 'base.state_es_m', # Madrid - 'ES617': 'base.state_es_ma', # Málaga - 'ES532': 'base.state_es_pm', # Mallorca - 'ES640': 'base.state_es_ml', # Melilla - 'ES533': 'base.state_es_ba', # Menorca - 'ES620': 'base.state_es_mu', # Murcia - 'ES220': 'base.state_es_na', # Navarra - 'ES113': 'base.state_es_or', # Ourense - 'ES414': 'base.state_es_p', # Palencia - 'ES114': 'base.state_es_po', # Pontevedra - 'ES415': 'base.state_es_sa', # Salamanca - 'ES416': 'base.state_es_sg', # Segovia - 'ES618': 'base.state_es_se', # Sevilla - 'ES417': 'base.state_es_so', # Soria - 'ES514': 'base.state_es_t', # Tarragona - 'ES709': 'base.state_es_tf', # Tenerife - 'ES242': 'base.state_es_te', # Teruel - 'ES425': 'base.state_es_to', # Toledo - 'ES523': 'base.state_es_v', # Valencia / València - 'ES418': 'base.state_es_va', # Valladolid - 'ES419': 'base.state_es_za', # Zamora - 'ES243': 'base.state_es_z', # Zaragoza - 'ESZZZ': False, # Extra-Regio NUTS 3 + "ES111": "base.state_es_c", # A Coruña + "ES421": "base.state_es_ab", # Albacete + "ES521": "base.state_es_a", # Alicante / Alacant + "ES611": "base.state_es_al", # Almería + "ES211": "base.state_es_vi", # Araba/Álava + "ES120": "base.state_es_o", # Asturias + "ES411": "base.state_es_av", # Ávila + "ES431": "base.state_es_ba", # Badajoz + "ES511": "base.state_es_b", # Barcelona + "ES213": "base.state_es_bi", # Bizkaia + "ES412": "base.state_es_bu", # Burgo + "ES432": "base.state_es_cc", # Cáceres + "ES612": "base.state_es_ca", # Cádiz + "ES130": "base.state_es_s", # Cantabria + "ES522": "base.state_es_cs", # Castellón / Castelló + "ES630": "base.state_es_ce", # Ceuta + "ES422": "base.state_es_cr", # Ciudad Real + "ES613": "base.state_es_co", # Córdoba + "ES423": "base.state_es_cu", # Cuenca + "ES531": "base.state_es_pm", # Eivissa y Formentera + "ES703": "base.state_es_tf", # El Hierro + "ES704": "base.state_es_gc", # Fuerteventura + "ES212": "base.state_es_ss", # Gipuzkoa + "ES512": "base.state_es_gi", # Girona + "ES705": "base.state_es_gc", # Gran Canaria + "ES614": "base.state_es_gr", # Granada + "ES424": "base.state_es_gu", # Guadalajara + "ES615": "base.state_es_h", # Huelva + "ES241": "base.state_es_hu", # Huesca + "ES616": "base.state_es_j", # Jaén + "ES706": "base.state_es_tf", # La Gomera + "ES707": "base.state_es_tf", # La Palma + "ES230": "base.state_es_lo", # La Rioja + "ES708": "base.state_es_gc", # Lanzarote + "ES413": "base.state_es_le", # León + "ES513": "base.state_es_l", # Lleida + "ES112": "base.state_es_lu", # Lugo + "ES300": "base.state_es_m", # Madrid + "ES617": "base.state_es_ma", # Málaga + "ES532": "base.state_es_pm", # Mallorca + "ES640": "base.state_es_ml", # Melilla + "ES533": "base.state_es_ba", # Menorca + "ES620": "base.state_es_mu", # Murcia + "ES220": "base.state_es_na", # Navarra + "ES113": "base.state_es_or", # Ourense + "ES414": "base.state_es_p", # Palencia + "ES114": "base.state_es_po", # Pontevedra + "ES415": "base.state_es_sa", # Salamanca + "ES416": "base.state_es_sg", # Segovia + "ES618": "base.state_es_se", # Sevilla + "ES417": "base.state_es_so", # Soria + "ES514": "base.state_es_t", # Tarragona + "ES709": "base.state_es_tf", # Tenerife + "ES242": "base.state_es_te", # Teruel + "ES425": "base.state_es_to", # Toledo + "ES523": "base.state_es_v", # Valencia / València + "ES418": "base.state_es_va", # Valladolid + "ES419": "base.state_es_za", # Zamora + "ES243": "base.state_es_z", # Zaragoza + "ESZZZ": False, # Extra-Regio NUTS 3 } @api.model def state_mapping(self, data, node): mapping = super(NutsImport, self).state_mapping(data, node) - level = data.get('level', 0) - code = data.get('code', '') - if self._current_country.code == 'ES' and level == 4: + level = data.get("level", 0) + code = data.get("code", "") + if self._current_country.code == "ES" and level == 4: toponyms = self._es_state_map.get(code, False) if toponyms: state = self.env.ref(toponyms) if state: - mapping['state_id'] = state.id + mapping["state_id"] = state.id return mapping From d47beff9a852d2e4d3f6ad0dca8d40847f87f389 Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Thu, 20 Jan 2022 23:07:58 -0500 Subject: [PATCH 09/19] [MIG] l10n_es_location_nuts: Migration to 14.0 --- l10n_es_location_nuts/README.rst | 23 +++++++++++-------- l10n_es_location_nuts/__manifest__.py | 4 ++-- l10n_es_location_nuts/readme/CONTRIBUTORS.rst | 13 +++++++---- .../static/description/index.html | 22 ++++++++++-------- l10n_es_location_nuts/wizard/nuts_import.py | 4 ++-- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/l10n_es_location_nuts/README.rst b/l10n_es_location_nuts/README.rst index 5c324dfa328..da7fe51ac1c 100644 --- a/l10n_es_location_nuts/README.rst +++ b/l10n_es_location_nuts/README.rst @@ -14,13 +14,13 @@ NUTS Regions for Spain :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-spain/tree/12.0/l10n_es_location_nuts + :target: https://github.com/OCA/l10n-spain/tree/14.0/l10n_es_location_nuts :alt: OCA/l10n-spain .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-spain-12-0/l10n-spain-12-0-l10n_es_location_nuts + :target: https://translation.odoo-community.org/projects/l10n-spain-14-0/l10n-spain-14-0-l10n_es_location_nuts :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/189/12.0 + :target: https://runbot.odoo-community.org/runbot/189/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -60,7 +60,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -75,11 +75,14 @@ Authors Contributors ~~~~~~~~~~~~ -* Antonio Espinosa -* Rafael Blasco -* Jairo Llopis -* David Vidal -* Alexandre Díaz +* `Tecnativa `_: + + * Antonio Espinosa + * Rafael Blasco + * Jairo Llopis + * David Vidal + * Alexandre Díaz + * Ernesto Tejeda Maintainers ~~~~~~~~~~~ @@ -94,6 +97,6 @@ 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. -This module is part of the `OCA/l10n-spain `_ project on GitHub. +This module is part of the `OCA/l10n-spain `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_es_location_nuts/__manifest__.py b/l10n_es_location_nuts/__manifest__.py index 74b98c13409..4fddd05fe46 100644 --- a/l10n_es_location_nuts/__manifest__.py +++ b/l10n_es_location_nuts/__manifest__.py @@ -5,10 +5,10 @@ { "name": "NUTS Regions for Spain", "summary": "NUTS specific options for Spain", - "version": "12.0.1.0.0", + "version": "14.0.1.0.0", "category": "Localisation/Europe", "website": "https://github.com/OCA/l10n-spain", - "author": "Tecnativa, " "Odoo Community Association (OCA)", + "author": "Tecnativa, Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, diff --git a/l10n_es_location_nuts/readme/CONTRIBUTORS.rst b/l10n_es_location_nuts/readme/CONTRIBUTORS.rst index e92a687e740..c24db8aac69 100644 --- a/l10n_es_location_nuts/readme/CONTRIBUTORS.rst +++ b/l10n_es_location_nuts/readme/CONTRIBUTORS.rst @@ -1,5 +1,8 @@ -* Antonio Espinosa -* Rafael Blasco -* Jairo Llopis -* David Vidal -* Alexandre Díaz +* `Tecnativa `_: + + * Antonio Espinosa + * Rafael Blasco + * Jairo Llopis + * David Vidal + * Alexandre Díaz + * Ernesto Tejeda diff --git a/l10n_es_location_nuts/static/description/index.html b/l10n_es_location_nuts/static/description/index.html index 763724d6c7c..98af552862c 100644 --- a/l10n_es_location_nuts/static/description/index.html +++ b/l10n_es_location_nuts/static/description/index.html @@ -3,7 +3,7 @@ - + NUTS Regions for Spain