Browse Source

[MRG] [ADD] add continent management addon

pull/2/head
unknown 11 years ago
committed by Yannick Vaucher
parent
commit
2279c991a7
  1. 24
      base_continent/__init__.py
  2. 42
      base_continent/__openerp__.py
  3. 34
      base_continent/base_continent.py
  4. 27
      base_continent/base_continent_data.xml
  5. 73
      base_continent/base_continent_view.xml
  6. 30
      base_continent/country.py
  7. 56
      base_continent/i18n/base_continent.po
  8. 56
      base_continent/i18n/fr.po
  9. 34
      base_continent/partner.py
  10. 3
      base_continent/security/ir.model.access.csv

24
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import base_continent
from . import country
from . import partner

42
base_continent/__openerp__.py

@ -0,0 +1,42 @@
# -*- 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'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',
'data': [
'base_continent_view.xml',
'base_continent_data.xml',
'security/ir.model.access.csv'],
'active': False,
'installable': True,
}

34
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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'

27
base_continent/base_continent_data.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="af" model="res.continent">
<field name="name">Africa</field>
</record>
<record id="an" model="res.continent">
<field name="name">Antarctica</field>
</record>
<record id="as" model="res.continent">
<field name="name">Asia</field>
</record>
<record id="eu" model="res.continent">
<field name="name">Europe</field>
</record>
<record id="na" model="res.continent">
<field name="name">North America</field>
</record>
<record id="oc" model="res.continent">
<field name="name">Oceania</field>
</record>
<record id="sa" model="res.continent">
<field name="name">South America</field>
</record>
</data>
</openerp>

73
base_continent/base_continent_view.xml

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- add continent to res country tree -->
<record model="ir.ui.view" id="view_country_tree_add_continent">
<field name="name">res.country.tree.add_continent</field>
<field name="model">res.country</field>
<field name="inherit_id" ref="base.view_country_tree" />
<field name="arch" type="xml">
<field name="code" position="after">
<field name="continent_id"/>
</field>
</field>
</record>
<!-- add continent to res country form -->
<record model="ir.ui.view" id="view_country_form_add_continent">
<field name="name">res.country.form.add_continent</field>
<field name="model">res.country</field>
<field name="inherit_id" ref="base.view_country_form"/>
<field name="arch" type="xml">
<field name="code" position="after">
<field name="continent_id"/>
</field>
</field>
</record>
<record id="view_continent_tree" model="ir.ui.view">
<field name="name">res.continent.tree</field>
<field name="model">res.continent</field>
<field name="arch" type="xml">
<tree string="Continent">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_continent_form" model="ir.ui.view">
<field name="name">res.continent.form</field>
<field name="model">res.continent</field>
<field name="arch" type="xml">
<form string="Continent" version="7.0">
<group>
<field name="name"/>
</group>
</form>
</field>
</record>
<record id="action_continent" model="ir.actions.act_window">
<field name="name">Continents</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.continent</field>
<field name="view_type">form</field>
<field name="help">Display and manage the list of all continents that can be assigned to your partner records.</field>
</record>
<menuitem action="action_continent" id="menu_continent_partner" parent="base.menu_localisation" sequence="1" groups="base.group_no_one"/>
<!-- add continent to res partner form -->
<record model="ir.ui.view" id="res_partner_form_add_continent">
<field name="name">res.partner.form.add_continent</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="country_id" position="after">
<field name="continent_id" widget="selection"/>
</field>
</field>
</record>
</data>
</openerp>

30
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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'),
}

56
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 ""

56
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"

34
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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),
}

3
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
Loading…
Cancel
Save