diff --git a/base_continent/README.rst b/base_continent/README.rst index eda08ea1c..c3d2b389f 100644 --- a/base_continent/README.rst +++ b/base_continent/README.rst @@ -20,7 +20,7 @@ You can now group partners per continent. .. 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 @@ -44,6 +44,8 @@ Contributors * Romain Deheele * Alexis de Lattre +* senseFly (http://sensefly.com) +* Quentin Theuret Maintainer ---------- diff --git a/base_continent/__manifest__.py b/base_continent/__manifest__.py index ac3cff296..f4423b749 100644 --- a/base_continent/__manifest__.py +++ b/base_continent/__manifest__.py @@ -1,13 +1,17 @@ # -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Author: Romain Deheele) +# © 2017 senseFly, Amaris (Author: Quentin Theuret) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Continent management', - 'version': '8.0.1.0.1', - 'depends': ['base'], - 'author': "Camptocamp,Odoo Community Association (OCA)", + 'version': '10.0.1.0.1', + 'depends': [ + 'base', + 'sales_team', + ], + 'author': "Camptocamp,senseFly,Amaris,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'category': 'Generic Modules/Base', 'data': [ @@ -18,5 +22,5 @@ 'data/country_data.xml', 'security/ir.model.access.csv', ], - 'installable': False, + 'installable': True, } diff --git a/base_continent/data/continent_data.xml b/base_continent/data/continent_data.xml index 555c433ea..6c385d755 100644 --- a/base_continent/data/continent_data.xml +++ b/base_continent/data/continent_data.xml @@ -1,27 +1,37 @@ - + + Africa + AF Antarctica + AN Asia + AS Europe + EU North America + NA Oceania + OC South America + SA + - + + diff --git a/base_continent/data/country_data.xml b/base_continent/data/country_data.xml index 6d9fe09c5..99656fda7 100644 --- a/base_continent/data/country_data.xml +++ b/base_continent/data/country_data.xml @@ -1,1021 +1,1020 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + diff --git a/base_continent/i18n/fr.po b/base_continent/i18n/fr.po index ad8e0774b..a39b7e7f5 100644 --- a/base_continent/i18n/fr.po +++ b/base_continent/i18n/fr.po @@ -1,22 +1,19 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * base_continent -# -# Translators: -# Quentin THEURET , 2017 +# * base_continent +# msgid "" msgstr "" -"Project-Id-Version: partner-contact (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-07-26 02:02+0000\n" -"PO-Revision-Date: 2017-08-03 14:01+0000\n" -"Last-Translator: Quentin THEURET \n" -"Language-Team: French (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/fr/)\n" +"POT-Creation-Date: 2017-12-15 15:22+0000\n" +"PO-Revision-Date: 2017-12-15 15:22+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" -"Language: fr\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Plural-Forms: \n" #. module: base_continent #: model:res.continent,name:base_continent.af @@ -35,28 +32,34 @@ msgstr "Asie" #. module: base_continent #: model:ir.model,name:base_continent.model_res_continent -#: view:res.continent:base_continent.view_continent_form -#: field:res.country,continent_id:0 -#: view:res.partner:base_continent.view_res_partner_filter -#: field:res.partner,continent_id:0 +#: model:ir.model.fields,field_description:base_continent.field_res_country_continent_id +#: model:ir.model.fields,field_description:base_continent.field_res_partner_continent_id +#: model:ir.model.fields,field_description:base_continent.field_res_users_continent_id +#: model:ir.ui.view,arch_db:base_continent.view_continent_form +#: model:ir.ui.view,arch_db:base_continent.view_res_partner_filter msgid "Continent" msgstr "Continent" #. module: base_continent -#: field:res.continent,name:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_code +msgid "Continent Code" +msgstr "Continent Code" + +#. module: base_continent +#: model:ir.model.fields,field_description:base_continent.field_res_continent_name msgid "Continent Name" msgstr "Nom du continent" #. module: base_continent #: model:ir.actions.act_window,name:base_continent.action_continent #: model:ir.ui.menu,name:base_continent.menu_continent_partner -#: view:res.continent:base_continent.view_continent_tree +#: model:ir.ui.view,arch_db:base_continent.view_continent_tree msgid "Continents" msgstr "Continents" #. module: base_continent -#: view:res.continent:base_continent.view_continent_form -#: field:res.continent,country_ids:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_country_ids +#: model:ir.ui.view,arch_db:base_continent.view_continent_form msgid "Countries" msgstr "Pays" @@ -66,25 +69,23 @@ msgid "Country" msgstr "Pays" #. module: base_continent -#: field:res.continent,create_uid:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_create_uid msgid "Created by" msgstr "Créé par" #. module: base_continent -#: field:res.continent,create_date:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_create_date msgid "Created on" msgstr "Créé le" #. module: base_continent -#: field:res.continent,display_name:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_display_name msgid "Display Name" msgstr "Nom affiché" #. module: base_continent #: model:ir.actions.act_window,help:base_continent.action_continent -msgid "" -"Display and manage the list of all continents that can be assigned to your " -"partner records." +msgid "Display and manage the list of all continents that can be assigned to your partner records." msgstr "Affiche et gère la liste de tous les continents qui peuvent être associés à vos partenaires." #. module: base_continent @@ -93,24 +94,24 @@ msgid "Europe" msgstr "Europe" #. module: base_continent -#: field:res.continent,id:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_id msgid "ID" msgstr "ID" #. module: base_continent -#: field:res.continent,__last_update:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent___last_update msgid "Last Modified on" -msgstr "Dernière modification le" +msgstr "Dernière Modification le" #. module: base_continent -#: field:res.continent,write_uid:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_write_uid msgid "Last Updated by" -msgstr "Dernière modification par" +msgstr "Dernière mise à jour par" #. module: base_continent -#: field:res.continent,write_date:0 +#: model:ir.model.fields,field_description:base_continent.field_res_continent_write_date msgid "Last Updated on" -msgstr "Dernière modification le" +msgstr "Dernière mise à jour le" #. module: base_continent #: model:res.continent,name:base_continent.na @@ -133,6 +134,7 @@ msgid "South America" msgstr "Amérique du Sud" #. module: base_continent -#: help:res.continent,name:0 +#: model:ir.model.fields,help:base_continent.field_res_continent_name msgid "The full name of the continent." msgstr "Le nom complet du continent." + diff --git a/base_continent/migrations/10.0.1.0.1/post-migration.py b/base_continent/migrations/10.0.1.0.1/post-migration.py new file mode 100644 index 000000000..db682268b --- /dev/null +++ b/base_continent/migrations/10.0.1.0.1/post-migration.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# © 2017 senseFly, Amaris (Author: Quentin Theuret) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +def migrate(cr, version): + continents = [ + ('af', 'AF'), + ('an', 'AN'), + ('as', 'AS'), + ('eu', 'EU'), + ('na', 'NA'), + ('oc', 'OC'), + ('sa', 'SA'), + ] + + for xml_id, code in continents: + cr.execute(""" + UPDATE res_continent SET code = %(code)s WHERE id = ( + SELECT res_id + FROM ir_model_data + WHERE model = 'res.continent' AND name = %(xml_id)s + );""", {'code': code, 'xml_id': xml_id}) diff --git a/base_continent/models/__init__.py b/base_continent/models/__init__.py index 7403f56be..099260659 100644 --- a/base_continent/models/__init__.py +++ b/base_continent/models/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from . import base_continent +from . import continent from . import country from . import partner diff --git a/base_continent/models/base_continent.py b/base_continent/models/continent.py similarity index 52% rename from base_continent/models/base_continent.py rename to base_continent/models/continent.py index 011b4faec..3ddd44c57 100644 --- a/base_continent/models/base_continent.py +++ b/base_continent/models/continent.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Author: Romain Deheele) +# © 2017 senseFly, Amaris (Author: Quentin Theuret) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields +from odoo import models +from odoo import fields class Continent(models.Model): @@ -13,6 +15,16 @@ class Continent(models.Model): name = fields.Char( string='Continent Name', help='The full name of the continent.', - required=True, translate=True) + required=True, + translate=True, + ) + code = fields.Char( + string='Continent Code', + size=2, + required=True, + ) country_ids = fields.One2many( - 'res.country', 'continent_id', string="Countries") + comodel_name='res.country', + inverse_name='continent_id', + string="Countries", + ) diff --git a/base_continent/models/country.py b/base_continent/models/country.py index 6e2e3cb8f..a00e52112 100644 --- a/base_continent/models/country.py +++ b/base_continent/models/country.py @@ -1,12 +1,17 @@ # -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Author: Romain Deheele) +# © 2017 senseFly, Amaris (Author: Quentin Theuret) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields +from odoo import models +from odoo import fields class Country(models.Model): _inherit = 'res.country' continent_id = fields.Many2one( - 'res.continent', string='Continent', ondelete='restrict') + comodel_name='res.continent', + string='Continent', + ondelete='restrict', + ) diff --git a/base_continent/models/partner.py b/base_continent/models/partner.py index 434770013..d1629bce8 100644 --- a/base_continent/models/partner.py +++ b/base_continent/models/partner.py @@ -1,13 +1,19 @@ # -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Author: Romain Deheele) +# © 2017 senseFly, Amaris (Author: Quentin Theuret) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields +from odoo import models +from odoo import fields class Partner(models.Model): _inherit = 'res.partner' continent_id = fields.Many2one( - 'res.continent', related='country_id.continent_id', - string='Continent', readonly=True, store=True) + 'res.continent', + related='country_id.continent_id', + string='Continent', + readonly=True, + store=True, + ) diff --git a/base_continent/views/continent.xml b/base_continent/views/continent.xml index dc031771a..365f4f85a 100644 --- a/base_continent/views/continent.xml +++ b/base_continent/views/continent.xml @@ -1,44 +1,43 @@ - - + - - res.continent.tree - res.continent - - - - - - + + res.continent.tree + res.continent + + + + + + + - - res.continent.form - res.continent - -
- - - - - - -
-
-
+ + res.continent.form + res.continent + +
+ + + + + + + +
+
+
- - Continents - res.continent - tree,form - Display and manage the list of all continents that can be assigned to your partner records. - + + Continents + res.continent + tree,form + Display and manage the list of all continents that can be assigned to your partner records. + - + - -
-
+ diff --git a/base_continent/views/country.xml b/base_continent/views/country.xml index 1a8d87ac7..c751e48d0 100644 --- a/base_continent/views/country.xml +++ b/base_continent/views/country.xml @@ -1,28 +1,26 @@ - - + - - res.country.tree.add_continent - res.country - - - - - + + res.country.tree.add_continent + res.country + + + + - + + - - res.country.form.add_continent - res.country - - - - - + + res.country.form.add_continent + res.country + + + + - + + - - + diff --git a/base_continent/views/partner.xml b/base_continent/views/partner.xml index 19267f675..0123989ae 100644 --- a/base_continent/views/partner.xml +++ b/base_continent/views/partner.xml @@ -1,28 +1,26 @@ - - + - - res.partner.form.add_continent - res.partner - - - - - + + res.partner.form.add_continent + res.partner + + + + - + + - - res.partner.filter.add_continent - res.partner - - - - - - - + + res.partner.filter.add_continent + res.partner + + + + + + + - - +