← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/partner-contact-management/base_continent into lp:partner-contact-management

 

Romain Deheele - Camptocamp has proposed merging lp:~camptocamp/partner-contact-management/base_continent into lp:partner-contact-management.

Requested reviews:
  Partner and Contact Core Editors (partner-contact-core-editors)

For more details, see:
https://code.launchpad.net/~camptocamp/partner-contact-management/base_continent/+merge/201452

Hello,

I propose a new addon : base_continent.
Simple addon to manage continents and display it on partner form.

Romain
-- 
https://code.launchpad.net/~camptocamp/partner-contact-management/base_continent/+merge/201452
Your team Partner and Contact Core Editors is requested to review the proposed merge of lp:~camptocamp/partner-contact-management/base_continent into lp:partner-contact-management.
=== added directory 'base_continent'
=== added file 'base_continent/__init__.py'
--- base_continent/__init__.py	1970-01-01 00:00:00 +0000
+++ base_continent/__init__.py	2014-01-13 16:36:22 +0000
@@ -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

=== added file 'base_continent/__openerp__.py'
--- base_continent/__openerp__.py	1970-01-01 00:00:00 +0000
+++ base_continent/__openerp__.py	2014-01-13 16:36:22 +0000
@@ -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,
+}

=== added file 'base_continent/base_continent.py'
--- base_continent/base_continent.py	1970-01-01 00:00:00 +0000
+++ base_continent/base_continent.py	2014-01-13 16:36:22 +0000
@@ -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'

=== added file 'base_continent/base_continent_view.xml'
--- base_continent/base_continent_view.xml	1970-01-01 00:00:00 +0000
+++ base_continent/base_continent_view.xml	2014-01-13 16:36:22 +0000
@@ -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>

=== added file 'base_continent/country.py'
--- base_continent/country.py	1970-01-01 00:00:00 +0000
+++ base_continent/country.py	2014-01-13 16:36:22 +0000
@@ -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'),
+    }

=== added file 'base_continent/partner.py'
--- base_continent/partner.py	1970-01-01 00:00:00 +0000
+++ base_continent/partner.py	2014-01-13 16:36:22 +0000
@@ -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),
+    }


Follow ups