diff --git a/base_location_nuts/README.rst b/base_location_nuts/README.rst index 0978044f8..4ecb18da6 100644 --- a/base_location_nuts/README.rst +++ b/base_location_nuts/README.rst @@ -14,13 +14,13 @@ NUTS Regions :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github - :target: https://github.com/OCA/partner-contact/tree/11.0/base_location_nuts + :target: https://github.com/OCA/partner-contact/tree/12.0/base_location_nuts :alt: OCA/partner-contact .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/partner-contact-11-0/partner-contact-11-0-base_location_nuts + :target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-base_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/134/11.0 + :target: https://runbot.odoo-community.org/runbot/134/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -79,7 +79,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. @@ -100,6 +100,7 @@ Contributors * Jairo Llopis * David Vidal * Simone Rubino +* Alexandre Díaz Maintainers ~~~~~~~~~~~ @@ -114,6 +115,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/partner-contact `_ project on GitHub. +This module is part of the `OCA/partner-contact `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_location_nuts/__manifest__.py b/base_location_nuts/__manifest__.py index a5a5b8f33..36f25414b 100644 --- a/base_location_nuts/__manifest__.py +++ b/base_location_nuts/__manifest__.py @@ -7,7 +7,7 @@ { 'name': 'NUTS Regions', 'category': 'Localisation/Europe', - 'version': '11.0.1.1.0', + 'version': '12.0.1.0.0', 'depends': [ 'contacts', ], diff --git a/base_location_nuts/migrations/12.0.1.0.0/post-migration.py b/base_location_nuts/migrations/12.0.1.0.0/post-migration.py new file mode 100644 index 000000000..0cbd6b701 --- /dev/null +++ b/base_location_nuts/migrations/12.0.1.0.0/post-migration.py @@ -0,0 +1,6 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + env['res.partner.nuts']._parent_store_compute() diff --git a/base_location_nuts/models/res_partner.py b/base_location_nuts/models/res_partner.py index 9524c3a75..927a9fc41 100644 --- a/base_location_nuts/models/res_partner.py +++ b/base_location_nuts/models/res_partner.py @@ -67,7 +67,7 @@ class ResPartner(models.Model): return self._onchange_nuts(1) @api.onchange('country_id') - def _onchange_country_id(self): + def _onchange_country_id_base_location_nuts(self): """Sensible values and domains for related fields.""" fields = ['state_id', 'nuts1_id', 'nuts2_id', 'nuts3_id', 'nuts4_id'] country_domain = ([('country_id', '=', self.country_id.id)] diff --git a/base_location_nuts/models/res_partner_nuts.py b/base_location_nuts/models/res_partner_nuts.py index c2a8ef446..6d4502735 100644 --- a/base_location_nuts/models/res_partner_nuts.py +++ b/base_location_nuts/models/res_partner_nuts.py @@ -7,7 +7,7 @@ from odoo import fields, models class ResPartnerNuts(models.Model): _name = 'res.partner.nuts' - _order = 'parent_left' + _order = 'parent_path' _parent_order = 'name' _parent_store = True _description = 'NUTS Item' @@ -24,8 +24,7 @@ class ResPartnerNuts(models.Model): # Parent hierarchy parent_id = fields.Many2one(comodel_name='res.partner.nuts', ondelete='restrict') + parent_path = fields.Char(index=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) diff --git a/base_location_nuts/readme/CONTRIBUTORS.rst b/base_location_nuts/readme/CONTRIBUTORS.rst index afbaec99e..9140ccea6 100644 --- a/base_location_nuts/readme/CONTRIBUTORS.rst +++ b/base_location_nuts/readme/CONTRIBUTORS.rst @@ -3,3 +3,4 @@ * Jairo Llopis * David Vidal * Simone Rubino +* Alexandre Díaz diff --git a/base_location_nuts/security/ir.model.access.csv b/base_location_nuts/security/ir.model.access.csv index 5d38ac660..af492e49e 100644 --- a/base_location_nuts/security/ir.model.access.csv +++ b/base_location_nuts/security/ir.model.access.csv @@ -1,2 +1,3 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_res_partner_nuts_user","res_partner_nuts group_user","model_res_partner_nuts","base.group_user",1,0,0,0 +"access_res_partner_nuts_user_all","res_partner_nuts group_partner_manager_all","model_res_partner_nuts","",1,0,0,0 +"access_res_partner_nuts_user","res_partner_nuts group_partner_manager","model_res_partner_nuts","base.group_partner_manager",1,1,1,1 diff --git a/base_location_nuts/static/description/index.html b/base_location_nuts/static/description/index.html index 4639136c8..847c4e798 100644 --- a/base_location_nuts/static/description/index.html +++ b/base_location_nuts/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

This module allows to import NUTS locations.

Creates four new fields in Partner object, one per NUTS level

@@ -454,7 +455,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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/partner-contact project on GitHub.

+

This module is part of the OCA/partner-contact project on GitHub.

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

diff --git a/base_location_nuts/tests/test_base_location_nuts.py b/base_location_nuts/tests/test_base_location_nuts.py index 0b69700b9..e94359217 100644 --- a/base_location_nuts/tests/test_base_location_nuts.py +++ b/base_location_nuts/tests/test_base_location_nuts.py @@ -44,7 +44,7 @@ class TestBaseLocationNuts(common.SavepointCase): def test_onchange_nuts(self): self.partner.country_id = self.country_2 - self.partner._onchange_country_id() + self.partner._onchange_country_id_base_location_nuts() self.assertEqual(self.partner.nuts1_id.country_id, self.partner.country_id) self.partner.nuts4_id = self.nuts4_1 @@ -57,7 +57,7 @@ class TestBaseLocationNuts(common.SavepointCase): 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.partner._onchange_country_id_base_location_nuts() self.assertEqual(self.partner.country_id, self.nuts1_2.country_id) self.assertFalse(self.partner.nuts2_id) self.assertFalse(self.partner.nuts3_id) diff --git a/base_location_nuts/views/res_partner_nuts_view.xml b/base_location_nuts/views/res_partner_nuts_view.xml index 34e3ec609..7ad733536 100644 --- a/base_location_nuts/views/res_partner_nuts_view.xml +++ b/base_location_nuts/views/res_partner_nuts_view.xml @@ -37,7 +37,6 @@ NUTS Items - ir.actions.act_window res.partner.nuts form tree,form @@ -55,10 +54,12 @@ - - @@ -68,6 +69,7 @@ diff --git a/base_location_nuts/views/res_partner_view.xml b/base_location_nuts/views/res_partner_view.xml index bdcd94057..7d9220fe4 100644 --- a/base_location_nuts/views/res_partner_view.xml +++ b/base_location_nuts/views/res_partner_view.xml @@ -33,20 +33,25 @@ - - - - +