Romain Deheele
11 years ago
6 changed files with 238 additions and 0 deletions
-
24base_continent/__init__.py
-
40base_continent/__openerp__.py
-
34base_continent/base_continent.py
-
76base_continent/base_continent_view.xml
-
30base_continent/country.py
-
34base_continent/partner.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 |
@ -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 <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", |
|||
"init_xml": [], |
|||
"demo_xml": [], |
|||
"update_xml": ["base_continent_view.xml"], |
|||
"active": False, |
|||
"installable": True, |
|||
} |
@ -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' |
@ -0,0 +1,76 @@ |
|||
<?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="type">tree</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="type">form</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="type">form</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> |
@ -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'), |
|||
} |
@ -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), |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue