Browse Source
Merge pull request #285 from akretion/8-continent-usability
Merge pull request #285 from akretion/8-continent-usability
8.0 base_continent: port to new API + usability enhancementspull/288/head
Rafael Blasco
9 years ago
committed by
GitHub
18 changed files with 1247 additions and 227 deletions
-
61base_continent/README.rst
-
25base_continent/__init__.py
-
36base_continent/__openerp__.py
-
34base_continent/base_continent.py
-
73base_continent/base_continent_view.xml
-
30base_continent/country.py
-
0base_continent/data/continent_data.xml
-
1021base_continent/data/country_data.xml
-
5base_continent/models/__init__.py
-
18base_continent/models/base_continent.py
-
12base_continent/models/country.py
-
13base_continent/models/partner.py
-
34base_continent/partner.py
-
44base_continent/views/continent.xml
-
28base_continent/views/country.xml
-
28base_continent/views/partner.xml
-
2base_partner_sequence/__openerp__.py
-
10base_partner_sequence/models/partner.py
@ -0,0 +1,61 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
============== |
|||
Base Continent |
|||
============== |
|||
|
|||
This module adds a *Continent* object (res.continent) and a link between continents and countries. It also adds a continent field on partners (automatically set if a country has been selected on the partner). |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
Go to the menu *Sales > Configuration > Address Book > Localization > Continents* to see the list of continents and assign countries to continents. |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
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 |
|||
|
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues |
|||
<https://github.com/OCA/partner-contact/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. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Images |
|||
------ |
|||
|
|||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Romain Deheele |
|||
* Alexis de Lattre <alexis.delattre@akretion.com> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
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. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -1,24 +1,3 @@ |
|||
# -*- 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/>. |
|||
# |
|||
############################################################################## |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import base_continent |
|||
from . import country |
|||
from . import partner |
|||
from . import models |
@ -1,41 +1,21 @@ |
|||
# -*- 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/>. |
|||
# |
|||
############################################################################## |
|||
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
|
|||
{ |
|||
'name': 'Continent management', |
|||
'version': '8.0.1.0.0', |
|||
'version': '8.0.1.0.1', |
|||
'depends': ['base'], |
|||
'author': "Camptocamp,Odoo Community Association (OCA)", |
|||
'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', |
|||
'views/continent.xml', |
|||
'views/country.xml', |
|||
'views/partner.xml', |
|||
'data/continent_data.xml', |
|||
'data/country_data.xml', |
|||
'security/ir.model.access.csv', |
|||
], |
|||
'installable': True, |
|||
|
@ -1,34 +0,0 @@ |
|||
# -*- 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' |
@ -1,73 +0,0 @@ |
|||
<?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> |
@ -1,30 +0,0 @@ |
|||
# -*- 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'), |
|||
} |
1021
base_continent/data/country_data.xml
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import base_continent |
|||
from . import country |
|||
from . import partner |
@ -0,0 +1,18 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from openerp import models, fields |
|||
|
|||
|
|||
class Continent(models.Model): |
|||
_name = 'res.continent' |
|||
_description = 'Continent' |
|||
_order = 'name' |
|||
|
|||
name = fields.Char( |
|||
string='Continent Name', |
|||
help='The full name of the continent.', |
|||
required=True, translate=True) |
|||
country_ids = fields.One2many( |
|||
'res.country', 'continent_id', string="Countries") |
@ -0,0 +1,12 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from openerp import models, fields |
|||
|
|||
|
|||
class Country(models.Model): |
|||
_inherit = 'res.country' |
|||
|
|||
continent_id = fields.Many2one( |
|||
'res.continent', string='Continent', ondelete='restrict') |
@ -0,0 +1,13 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from openerp import models, 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) |
@ -1,34 +0,0 @@ |
|||
# -*- 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), |
|||
} |
@ -0,0 +1,44 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<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="Continents"> |
|||
<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"> |
|||
<group name="main"> |
|||
<field name="name"/> |
|||
</group> |
|||
<group name="countries" string="Countries"> |
|||
<field name="country_ids" nolabel="1" readonly="1"/> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_continent" model="ir.actions.act_window"> |
|||
<field name="name">Continents</field> |
|||
<field name="res_model">res.continent</field> |
|||
<field name="view_mode">tree,form</field> |
|||
<field name="help">Display and manage the list of all continents that can be assigned to your partner records.</field> |
|||
</record> |
|||
|
|||
<menuitem id="menu_continent_partner" |
|||
action="action_continent" |
|||
parent="base.menu_localisation" |
|||
sequence="1" groups="base.group_no_one"/> |
|||
|
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="view_country_tree_add_continent" model="ir.ui.view"> |
|||
<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> |
|||
|
|||
<record id="view_country_form_add_continent" model="ir.ui.view"> |
|||
<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> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="res_partner_form_add_continent" model="ir.ui.view"> |
|||
<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"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_res_partner_filter" model="ir.ui.view"> |
|||
<field name="name">res.partner.filter.add_continent</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_res_partner_filter"/> |
|||
<field name="arch" type="xml"> |
|||
<group expand="0" position="inside"> |
|||
<filter string="Continent" name="continent_groupby" context="{'group_by': 'continent_id'}"/> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue