From ae875f10378ec35fc2bb500b19c730614ecb963a Mon Sep 17 00:00:00 2001 From: Romain Deheele Date: Mon, 13 Jan 2014 17:34:23 +0100 Subject: [PATCH 1/6] [ADD] add continent management addon --- base_continent/__init__.py | 24 ++++++++ base_continent/__openerp__.py | 40 ++++++++++++++ base_continent/base_continent.py | 34 ++++++++++++ base_continent/base_continent_view.xml | 76 ++++++++++++++++++++++++++ base_continent/country.py | 30 ++++++++++ base_continent/partner.py | 34 ++++++++++++ 6 files changed, 238 insertions(+) create mode 100644 base_continent/__init__.py create mode 100644 base_continent/__openerp__.py create mode 100644 base_continent/base_continent.py create mode 100644 base_continent/base_continent_view.xml create mode 100644 base_continent/country.py create mode 100644 base_continent/partner.py diff --git a/base_continent/__init__.py b/base_continent/__init__.py new file mode 100644 index 000000000..89a35d724 --- /dev/null +++ b/base_continent/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Author: Romain Deheele +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import base_continent +from . import country +from . import partner diff --git a/base_continent/__openerp__.py b/base_continent/__openerp__.py new file mode 100644 index 000000000..d663a0d5e --- /dev/null +++ b/base_continent/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Romain Deheele +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{"name": "Continent management", + "version": "1.0", + "depends": ["base"], + "author": "Camptocamp", + "license": "AGPL-3", + "description": """ +This module introduces continent management. +============================================ +Links continents to countries, +adds continent field on partner form +""", + "category": "Generic Modules/Base", + "init_xml": [], + "demo_xml": [], + "update_xml": ["base_continent_view.xml"], + "active": False, + "installable": True, +} diff --git a/base_continent/base_continent.py b/base_continent/base_continent.py new file mode 100644 index 000000000..c48051841 --- /dev/null +++ b/base_continent/base_continent.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Romain Deheele +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv.orm import Model +from openerp.osv import fields + + +class Continent(Model): + _name = 'res.continent' + _description = 'Continent' + _columns = { + 'name': fields.char('Continent Name', size=64, + help='The full name of the continent.', + required=True, translate=True), + } + _order = 'name' diff --git a/base_continent/base_continent_view.xml b/base_continent/base_continent_view.xml new file mode 100644 index 000000000..e3f3ccecc --- /dev/null +++ b/base_continent/base_continent_view.xml @@ -0,0 +1,76 @@ + + + + + + res.country.tree.add_continent + res.country + tree + + + + + + + + + + + res.country.form.add_continent + form + res.country + + + + + + + + + + res.continent.tree + res.continent + + + + + + + + + res.continent.form + res.continent + +
+ + + +
+
+
+ + + Continents + ir.actions.act_window + res.continent + form + Display and manage the list of all continents that can be assigned to your partner records. + + + + + + + res.partner.form.add_continent + form + res.partner + + + + + + + + +
+
diff --git a/base_continent/country.py b/base_continent/country.py new file mode 100644 index 000000000..b4395763b --- /dev/null +++ b/base_continent/country.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Romain Deheele +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv.orm import Model +from openerp.osv import fields + + +class Country(Model): + _inherit = 'res.country' + _columns = { + 'continent_id': fields.many2one('res.continent', 'Continent'), + } diff --git a/base_continent/partner.py b/base_continent/partner.py new file mode 100644 index 000000000..a5656652c --- /dev/null +++ b/base_continent/partner.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Romain Deheele +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv.orm import Model +from openerp.osv import fields + + +class Partner(Model): + _inherit = 'res.partner' + _columns = { + 'continent_id': fields.related('country_id', 'continent_id', + type='many2one', + relation='res.continent', + string='Continent', + readonly=True, store=True), + } From 6ce4d9c410af2791c04aeb655191d6c37734eea3 Mon Sep 17 00:00:00 2001 From: Romain Deheele Date: Tue, 14 Jan 2014 16:39:01 +0100 Subject: [PATCH 2/6] [ADD] add template and fr po --- base_continent/i18n/base_continent.po | 56 +++++++++++++++++++++++++++ base_continent/i18n/fr.po | 56 +++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 base_continent/i18n/base_continent.po create mode 100644 base_continent/i18n/fr.po diff --git a/base_continent/i18n/base_continent.po b/base_continent/i18n/base_continent.po new file mode 100644 index 000000000..d758f85de --- /dev/null +++ b/base_continent/i18n/base_continent.po @@ -0,0 +1,56 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * base_continent +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-14 15:19+0000\n" +"PO-Revision-Date: 2014-01-14 15:19+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_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." +msgstr "" + +#. module: base_continent +#: model:ir.actions.act_window,name:base_continent.action_continent +#: model:ir.ui.menu,name:base_continent.menu_continent_partner +msgid "Continents" +msgstr "" + +#. module: base_continent +#: model:ir.model,name:base_continent.model_res_country +msgid "Country" +msgstr "" + +#. module: base_continent +#: help:res.continent,name:0 +msgid "The full name of the continent." +msgstr "" + +#. module: base_continent +#: field:res.continent,name:0 +msgid "Continent Name" +msgstr "" + +#. module: base_continent +#: model:ir.model,name:base_continent.model_res_partner +msgid "Partner" +msgstr "" + +#. module: base_continent +#: model:ir.model,name:base_continent.model_res_continent +#: view:res.continent:0 +#: field:res.country,continent_id:0 +#: field:res.partner,continent_id:0 +msgid "Continent" +msgstr "" + diff --git a/base_continent/i18n/fr.po b/base_continent/i18n/fr.po new file mode 100644 index 000000000..1925f16aa --- /dev/null +++ b/base_continent/i18n/fr.po @@ -0,0 +1,56 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * base_continent +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-14 15:19+0000\n" +"PO-Revision-Date: 2014-01-14 15:19+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_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." +msgstr "Affiche et gère la liste de tous les continents qui peuvent être associés à vos partenaires." + +#. module: base_continent +#: model:ir.actions.act_window,name:base_continent.action_continent +#: model:ir.ui.menu,name:base_continent.menu_continent_partner +msgid "Continents" +msgstr "Continents" + +#. module: base_continent +#: model:ir.model,name:base_continent.model_res_country +msgid "Country" +msgstr "Pays" + +#. module: base_continent +#: help:res.continent,name:0 +msgid "The full name of the continent." +msgstr "Le nom complet du continent." + +#. module: base_continent +#: field:res.continent,name:0 +msgid "Continent Name" +msgstr "Nom du continent" + +#. module: base_continent +#: model:ir.model,name:base_continent.model_res_partner +msgid "Partner" +msgstr "Partenaire" + +#. module: base_continent +#: model:ir.model,name:base_continent.model_res_continent +#: view:res.continent:0 +#: field:res.country,continent_id:0 +#: field:res.partner,continent_id:0 +msgid "Continent" +msgstr "Continent" + From 43bc2667cf98def1db81f4af7fcee8098fe010dc Mon Sep 17 00:00:00 2001 From: Romain Deheele Date: Tue, 14 Jan 2014 16:39:36 +0100 Subject: [PATCH 3/6] [ADD] add continent datas --- base_continent/__openerp__.py | 26 +++++++++++++------------ base_continent/base_continent_data.xml | 27 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 base_continent/base_continent_data.xml diff --git a/base_continent/__openerp__.py b/base_continent/__openerp__.py index d663a0d5e..851c0950c 100644 --- a/base_continent/__openerp__.py +++ b/base_continent/__openerp__.py @@ -20,21 +20,23 @@ ############################################################################## -{"name": "Continent management", - "version": "1.0", - "depends": ["base"], - "author": "Camptocamp", - "license": "AGPL-3", - "description": """ +{'name': 'Continent management', + 'version': '1.0', + 'depends': ['base'], + 'author': 'Camptocamp', + 'license': 'AGPL-3', + 'description': """ This module introduces continent management. ============================================ Links continents to countries, adds continent field on partner form """, - "category": "Generic Modules/Base", - "init_xml": [], - "demo_xml": [], - "update_xml": ["base_continent_view.xml"], - "active": False, - "installable": True, + 'category': 'Generic Modules/Base', + 'init_xml': [], + 'demo_xml': [], + 'update_xml': [ + 'base_continent_view.xml', + 'base_continent_data.xml'], + 'active': False, + 'installable': True, } diff --git a/base_continent/base_continent_data.xml b/base_continent/base_continent_data.xml new file mode 100644 index 000000000..555c433ea --- /dev/null +++ b/base_continent/base_continent_data.xml @@ -0,0 +1,27 @@ + + + + + + Africa + + + Antarctica + + + Asia + + + Europe + + + North America + + + Oceania + + + South America + + + From 64486bd9a4ae0ae969946fddd98e98c98b3696bc Mon Sep 17 00:00:00 2001 From: Romain Deheele Date: Wed, 15 Jan 2014 15:01:37 +0100 Subject: [PATCH 4/6] [FIX] remove deprecated types on views --- base_continent/base_continent_view.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/base_continent/base_continent_view.xml b/base_continent/base_continent_view.xml index e3f3ccecc..7522bbf01 100644 --- a/base_continent/base_continent_view.xml +++ b/base_continent/base_continent_view.xml @@ -5,7 +5,6 @@ res.country.tree.add_continent res.country - tree @@ -17,7 +16,6 @@ res.country.form.add_continent - form res.country @@ -62,7 +60,6 @@ res.partner.form.add_continent - form res.partner From f18e606e14ecb2d9d88f6a5114291a60e8b2040c Mon Sep 17 00:00:00 2001 From: Romain Deheele Date: Wed, 15 Jan 2014 15:15:56 +0100 Subject: [PATCH 5/6] [UPD] add access rights --- base_continent/__openerp__.py | 3 ++- base_continent/security/ir.model.access.csv | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 base_continent/security/ir.model.access.csv diff --git a/base_continent/__openerp__.py b/base_continent/__openerp__.py index 851c0950c..5ee59048a 100644 --- a/base_continent/__openerp__.py +++ b/base_continent/__openerp__.py @@ -36,7 +36,8 @@ adds continent field on partner form 'demo_xml': [], 'update_xml': [ 'base_continent_view.xml', - 'base_continent_data.xml'], + 'base_continent_data.xml', + 'security/ir.model.access.csv'], 'active': False, 'installable': True, } diff --git a/base_continent/security/ir.model.access.csv b/base_continent/security/ir.model.access.csv new file mode 100644 index 000000000..69ee73366 --- /dev/null +++ b/base_continent/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_res_continent_group_all,res_continent group_user_all,model_res_continent,,1,0,0,0 +access_res_continent_group_user,res_continent group_user,model_res_continent,base.group_partner_manager,1,1,1,1 From 709f90e57aeac49584a19e117d9babc763d1c908 Mon Sep 17 00:00:00 2001 From: Romain Deheele Date: Wed, 15 Jan 2014 15:28:51 +0100 Subject: [PATCH 6/6] [UPD] change deprecated keys in __openerp__.py --- base_continent/__openerp__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/base_continent/__openerp__.py b/base_continent/__openerp__.py index 5ee59048a..d0e25dd02 100644 --- a/base_continent/__openerp__.py +++ b/base_continent/__openerp__.py @@ -20,7 +20,8 @@ ############################################################################## -{'name': 'Continent management', +{ + 'name': 'Continent management', 'version': '1.0', 'depends': ['base'], 'author': 'Camptocamp', @@ -32,9 +33,7 @@ Links continents to countries, adds continent field on partner form """, 'category': 'Generic Modules/Base', - 'init_xml': [], - 'demo_xml': [], - 'update_xml': [ + 'data': [ 'base_continent_view.xml', 'base_continent_data.xml', 'security/ir.model.access.csv'],