← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~savoirfairelinux-openerp/partner-contact-management/partner-contact-management-base_contact_add_modules into lp:partner-contact-management

 

elhadji.dem@xxxxxxxxxxxxxxxxxxxx has proposed merging lp:~savoirfairelinux-openerp/partner-contact-management/partner-contact-management-base_contact_add_modules into lp:partner-contact-management.

Requested reviews:
  Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/partner-contact-management/partner-contact-management-base_contact_add_modules/+merge/204008

- [ADD] added base_contact_by_functions module: It allow to manage contacts by function"
- [ADD] Added base_contact_by_functions_partner_firstname  module: It allows to add firstname before name.Name is considered like the lastname and we have firstname and lastname on partner view and contact view."
The base_contact_by_functions_partner_firstname  module depends on partner_firstname and base_contact_by_functions module.
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/partner-contact-management/partner-contact-management-base_contact_add_modules/+merge/204008
Your team Partner and Contact Core Editors is subscribed to branch lp:partner-contact-management.
=== added directory 'base_contact'
=== added file 'base_contact/__init__.py'
--- base_contact/__init__.py	1970-01-01 00:00:00 +0000
+++ base_contact/__init__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2013-TODAY OpenERP SA (<http://www.openerp.com>).
+#
+#    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 . import base_contact

=== added file 'base_contact/__openerp__.py'
--- base_contact/__openerp__.py	1970-01-01 00:00:00 +0000
+++ base_contact/__openerp__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Business Applications
+#    Copyright (C) 2013-TODAY OpenERP S.A. (<http://openerp.com>).
+#
+#    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': 'Contacts Management',
+    'version': '1.0',
+    'author': 'OpenERP SA',
+    'website': 'http://www.openerp.com',
+    'category': 'Customer Relationship Management',
+    'complexity': "expert",
+    'description': """
+This module allows you to manage your contacts
+==============================================
+
+It lets you define groups of contacts sharing some common information, like:
+    * Birthdate
+    * Nationality
+    * Native Language
+
+Contributors
+------------
+* OpenERP SA
+* El Hadji Dem (elhadji.dem@xxxxxxxxxxxxxxxxxxxx
+""",
+    'depends': [
+        'base',
+        'process',
+        'contacts'
+    ],
+    'external_dependencies': {},
+    'data': [
+        'base_contact_view.xml',
+    ],
+    'demo': [
+        'base_contact_demo.xml',
+    ],
+    'test': [],
+    'installable': True,
+    'auto_install': False,
+    'images': [],
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact/base_contact.py'
--- base_contact/base_contact.py	1970-01-01 00:00:00 +0000
+++ base_contact/base_contact.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,214 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2013-TODAY OpenERP SA (<http://www.openerp.com>).
+#
+#    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 import fields, orm, expression
+
+
+class res_partner(orm.Model):
+    _inherit = 'res.partner'
+
+    _contact_type = [
+        ('standalone', 'Standalone Contact'),
+        ('attached', 'Attached to existing Contact'),
+    ]
+
+    def _get_contact_type(self, cr, uid, ids, field_name, args, context=None):
+        if context is None:
+            context = {}
+        result = dict.fromkeys(ids, 'standalone')
+        for partner in self.browse(cr, uid, ids, context=context):
+            if partner.contact_id:
+                result[partner.id] = 'attached'
+        return result
+
+    _columns = {
+        'contact_type': fields.function(_get_contact_type, type='selection',
+                                        selection=_contact_type,
+                                        string='Contact Type',
+                                        required=True,
+                                        select=1,
+                                        store=True,
+                                        help="Contact type."),
+        'contact_id': fields.many2one('res.partner', 'Main Contact',
+                                      domain=[('is_company', '=', False),
+                                              ('contact_type', '=', 'standalone')],
+                                      help="Contact."),
+        'other_contact_ids': fields.one2many('res.partner',
+                                             'contact_id',
+                                             'Others Positions',
+                                             help="Others Positions."),
+        # Person specific fields
+        # add a 'birthdate' as date field, i.e different from char 'birthdate' introduced v6.1!
+        'birthdate_date': fields.date('Birthdate', help="Birthdate."),
+        'nationality_id': fields.many2one('res.country', 'Nationality', help="Nationality."),
+    }
+
+    _defaults = {
+        'contact_type': 'standalone',
+    }
+
+    def _basecontact_check_context(self, cr, user, mode, context=None):
+        if context is None:
+            context = {}
+        """
+        Remove 'search_show_all_positions' for non-search mode.
+        Keeping it in context can result in unexpected behaviour (ex: reading
+        one2many might return wrong result - i.e with "attached contact" removed
+        even if it's directly linked to a company).
+        """
+        if mode != 'search':
+            context.pop('search_show_all_positions', None)
+        return context
+
+    def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
+        if context is None:
+            context = {}
+        if context.get('search_show_all_positions') is False:
+            """
+            Display only standalone contact matching ``args`` or having
+            attached contact matching ``args``
+            """
+
+            args = expression.normalize_domain(args)
+            attached_contact_args = expression.AND((args, [('contact_type', '=', 'attached')]))
+            attached_contact_ids = super(res_partner, self).search(cr, user, attached_contact_args,
+                                                                   context=context)
+            args = expression.OR((
+                expression.AND(([('contact_type', '=', 'standalone')], args)),
+                [('other_contact_ids', 'in', attached_contact_ids)],
+            ))
+        return super(res_partner, self).search(cr, user, args, offset=offset, limit=limit,
+                                               order=order, context=context, count=count)
+
+    def create(self, cr, user, vals, context=None):
+        context = self._basecontact_check_context(cr, user, 'create', context)
+        if not vals.get('name') and vals.get('contact_id'):
+            vals['name'] = self.browse(cr, user, vals['contact_id'], context=context).name
+        return super(res_partner, self).create(cr, user, vals, context=context)
+
+    def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
+        context = self._basecontact_check_context(cr, user, 'read', context)
+        return super(res_partner, self).read(cr, user, ids, fields=fields, context=context, load=load)
+
+    def write(self, cr, user, ids, vals, context=None):
+        context = self._basecontact_check_context(cr, user, 'write', context)
+        return super(res_partner, self).write(cr, user, ids, vals, context=context)
+
+    def unlink(self, cr, user, ids, context=None):
+        context = self._basecontact_check_context(cr, user, 'unlink', context)
+        return super(res_partner, self).unlink(cr, user, ids, context=context)
+
+    def _commercial_partner_compute(self, cr, uid, ids, name, args, context=None):
+        """
+        Returns the partner that is considered the commercial
+        entity of this partner. The commercial entity holds the master data
+        for all commercial fields (see :py:meth:`~_commercial_fields`)
+        """
+        result = super(res_partner, self)._commercial_partner_compute(cr, uid, ids, name, args, context=context)
+        for partner in self.browse(cr, uid, ids, context=context):
+            if partner.contact_type == 'attached' and not partner.parent_id:
+                result[partner.id] = partner.contact_id.id
+        return result
+
+    def _contact_fields(self, cr, uid, context=None):
+        """
+        Returns the list of contact fields that are synced from the parent
+        when a partner is attached to him.
+        """
+        return ['name', 'title']
+
+    def _contact_sync_from_parent(self, cr, uid, partner, context=None):
+        """
+        Handle sync of contact fields when a new parent contact entity is set,
+        as if they were related fields
+        """
+        if partner.contact_id:
+            contact_fields = self._contact_fields(cr, uid, context=context)
+            sync_vals = self._update_fields_values(cr, uid, partner.contact_id,
+                                                   contact_fields, context=context)
+            partner.write(sync_vals)
+
+    def update_contact(self, cr, uid, ids, vals, context=None):
+        if context is None:
+            context = {}
+        if context.get('__update_contact_lock'):
+            return
+        contact_fields = self._contact_fields(cr, uid, context=context)
+        contact_vals = dict((field, vals[field]) for field in contact_fields if field in vals)
+        if contact_vals:
+            ctx = dict(context, __update_contact_lock=True)
+            self.write(cr, uid, ids, contact_vals, context=ctx)
+
+    def _fields_sync(self, cr, uid, partner, update_values, context=None):
+        """
+        Sync commercial fields and address fields from company and to children,
+        contact fields from contact and to attached contact after create/update,
+        just as if those were all modeled as fields.related to the parent
+        """
+        if context is None:
+            context = {}
+        super(res_partner, self)._fields_sync(cr, uid, partner, update_values, context=context)
+        contact_fields = self._contact_fields(cr, uid, context=context)
+        # 1. From UPSTREAM: sync from parent contact
+        if update_values.get('contact_id'):
+            self._contact_sync_from_parent(cr, uid, partner, context=context)
+        # 2. To DOWNSTREAM: sync contact fields to parent or related
+        elif any(field in contact_fields for field in update_values):
+            update_ids = [c.id for c in partner.other_contact_ids if not c.is_company]
+            if partner.contact_id:
+                update_ids.append(partner.contact_id.id)
+            self.update_contact(cr, uid, update_ids, update_values, context=context)
+
+    def onchange_contact_id(self, cr, uid, ids, contact_id, context=None):
+        values = {}
+        if contact_id:
+            values['name'] = self.browse(cr, uid, contact_id, context=context).name
+        return {'value': values}
+
+    def onchange_contact_type(self, cr, uid, ids, contact_type, context=None):
+        values = {}
+        if contact_type == 'standalone':
+            values['contact_id'] = False
+        return {'value': values}
+
+
+class ir_actions_window(orm.Model):
+    _inherit = 'ir.actions.act_window'
+
+    def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
+        action_ids = ids
+        if isinstance(ids, (int, long)):
+            action_ids = [ids]
+        actions = super(ir_actions_window, self).read(cr, user, action_ids, fields=fields, context=context, load=load)
+        for action in actions:
+            if action.get('res_model', '') == 'res.partner':
+                # By default, only show standalone contact
+                action_context = action.get('context', '{}') or '{}'
+                if 'search_show_all_positions' not in action_context:
+                    action['context'] = action_context.replace('{',
+                                                               "{'search_show_all_positions': False,", 1)
+        if isinstance(ids, (int, long)):
+            if actions:
+                return actions[0]
+            return False
+        return actions
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact/base_contact_demo.xml'
--- base_contact/base_contact_demo.xml	1970-01-01 00:00:00 +0000
+++ base_contact/base_contact_demo.xml	2014-01-30 15:45:21 +0000
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <record id="res_partner_main2_position_consultant" model="res.partner">
+            <field name="name">Roger Scott</field>
+            <field name="function">Consultant</field>
+            <field name="parent_id" ref="base.res_partner_11"/>
+            <field name="contact_id" ref="base.res_partner_main2"/>
+            <field name="use_parent_address" eval="True"/>
+        </record>
+
+        <record id="res_partner_contact1" model="res.partner">
+            <field name="name">Bob Egnops</field>
+            <field name="birthdate_date">1984-01-01</field>
+            <field name="email">bob@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</field>
+        </record>
+
+        <record id="res_partner_contact1_work_position1" model="res.partner">
+            <field name="name">Bob Egnops</field>
+            <field name="function">Technician</field>
+            <field name="email">bob@xxxxxxxxxxxxxxx</field>
+            <field name="parent_id" ref="base.main_partner"/>
+            <field name="contact_id" ref="res_partner_contact1"/>
+            <field name="use_parent_address" eval="True"/>
+        </record>
+
+    </data>
+</openerp>
\ No newline at end of file

=== added file 'base_contact/base_contact_view.xml'
--- base_contact/base_contact_view.xml	1970-01-01 00:00:00 +0000
+++ base_contact/base_contact_view.xml	2014-01-30 15:45:21 +0000
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <record id="view_res_partner_filter_contact" model="ir.ui.view">
+        <field name="name">res.partner.select.contact</field>
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="base.view_res_partner_filter"/>
+        <field name="arch" type="xml">
+            <filter name="type_company" position="after">
+                <separator/>
+                <filter string="All positions" name="type_otherpositions"
+                        context="{'search_show_all_positions': True}"
+                        help="All partner positions"/>
+            </filter>
+            <xpath expr="/search/group/filter[@string='Company']" position="before">
+                <filter string="Person" name="group_person" context="{'group_by': 'contact_id'}"/>
+            </xpath>
+        </field>
+    </record>
+
+    <record id="view_res_partner_tree_contact" model="ir.ui.view">
+        <field name="name">res.partner.tree.contact</field>
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="base.view_partner_tree"/>
+        <field name="arch" type="xml">
+            <field name="parent_id" position="after">
+                <field name="contact_id" invisible="1"/>
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_partner_form_inherit">
+        <field name="name">res.partner.form.contact</field>
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="base.view_partner_form"/>
+        <field name="type">form</field>
+        <field name="arch" type="xml">
+            <field name="is_company" position="after">
+                <field name="contact_type" invisible="1"/>
+            </field>
+            <page string="Contacts" position="after">
+                <page string="Other Positions" attrs="{'invisible': ['|',('is_company','=',True),('contact_id','!=',False)]}">
+                    <field name="other_contact_ids" context="{'default_contact_id': active_id, 'default_name': name, 'default_street': street, 'default_street2': street2, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_supplier': supplier}}" mode="kanban">
+                        <kanban>
+                            <field name="color"/>
+                            <field name="name"/>
+                            <field name="title"/>
+                            <field name="email"/>
+                            <field name="parent_id"/>
+                            <field name="is_company"/>
+                            <field name="function"/>
+                            <field name="phone"/>
+                            <field name="street"/>
+                            <field name="street2"/>
+                            <field name="zip"/>
+                            <field name="city"/>
+                            <field name="country_id"/>
+                            <field name="mobile"/>
+                            <field name="fax"/>
+                            <field name="state_id"/>
+                            <field name="has_image"/>
+                            <templates>
+                                <t t-name="kanban-box">
+                                    <t t-set="color" t-value="kanban_color(record.color.raw_value)"/>
+                                    <div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')" style="position: relative">
+                                        <a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
+                                        <div class="oe_module_vignette">
+                                        <a type="open">
+                                            <t t-if="record.has_image.raw_value === true">
+                                                <img t-att-src="kanban_image('res.partner', 'image', record.id.value, {'preview_image': 'image_small'})" class="oe_avatar oe_kanban_avatar_smallbox"/>
+                                            </t>
+                                            <t t-if="record.image and record.image.raw_value !== false">
+                                                <img t-att-src="'data:image/png;base64,'+record.image.raw_value" class="oe_avatar oe_kanban_avatar_smallbox"/>
+                                            </t>
+                                            <t t-if="record.has_image.raw_value === false and (!record.image or record.image.raw_value === false)">
+                                                <t t-if="record.is_company.raw_value === true">
+                                                    <img t-att-src='_s + "/base/static/src/img/company_image.png"' class="oe_kanban_image oe_kanban_avatar_smallbox"/>
+                                                </t>
+                                                <t t-if="record.is_company.raw_value === false">
+                                                    <img t-att-src='_s + "/base/static/src/img/avatar.png"' class="oe_kanban_image oe_kanban_avatar_smallbox"/>
+                                                </t>
+                                            </t>
+                                        </a>
+                                            <div class="oe_module_desc">
+                                                <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border">
+                                                    <table class="oe_kanban_table">
+                                                        <tr>
+                                                            <td class="oe_kanban_title1" align="left" valign="middle">
+                                                                <h4><a type="open"><field name="name"/></a></h4>
+                                                                <i>
+                                                                    <t t-if="record.parent_id.raw_value and !record.function.raw_value"><field name="parent_id"/></t>
+                                                                    <t t-if="!record.parent_id.raw_value and record.function.raw_value"><field name="function"/></t>
+                                                                    <t t-if="record.parent_id.raw_value and record.function.raw_value"><field name="function"/> à <field name="parent_id"/></t>
+                                                                </i>
+                                                                <div><a t-if="record.email.raw_value" title="Mail" t-att-href="'mailto:'+record.email.value">
+                                                                    <field name="email"/>
+                                                                </a></div>
+                                                                <div t-if="record.phone.raw_value">Phone: <field name="phone"/></div>
+                                                                <div t-if="record.mobile.raw_value">Mobile: <field name="mobile"/></div>
+                                                                <div t-if="record.fax.raw_value">Fax: <field name="fax"/></div>
+                                                            </td>
+                                                        </tr>
+                                                    </table>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </t>
+                            </templates>
+                        </kanban>
+                        <form string="Contact" version="7.0">
+                            <sheet>
+                                <field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_medium"}'/>
+                                <div class="oe_title">
+                                    <label for="name" class="oe_edit_only"/>
+                                    <h1><field name="name" style="width: 70%%"/></h1>
+                                </div>
+                                <group>
+                                    <!-- inherited part -->
+                                    <field name="category_id" widget="many2many_tags" placeholder="Tags..." style="width: 70%%"/>
+                                    <field name="parent_id" placeholder="Company" domain="[('is_company','=',True)]"/>
+                                    <!-- inherited part end -->
+                                    <field name="function" placeholder="e.g. Sales Director"/>
+                                    <field name="email"/>
+                                    <field name="phone"/>
+                                    <field name="mobile"/>
+                                </group>
+                                <div>
+                                    <field name="use_parent_address"/><label for="use_parent_address"/>
+                                </div>
+                                <group>
+                                    <label for="type"/>
+                                    <div name="div_type">
+                                        <field class="oe_inline" name="type"/>
+                                    </div>
+                                    <label for="street" string="Address" attrs="{'invisible': [('use_parent_address','=', True)]}"/>
+                                    <div attrs="{'invisible': [('use_parent_address','=', True)]}" name="div_address">
+                                        <field name="street" placeholder="Street..."/>
+                                        <field name="street2"/>
+                                        <div class="address_format">
+                                            <field name="city" placeholder="City" style="width: 40%%"/>
+                                            <field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)"/>
+                                            <field name="zip" placeholder="ZIP" style="width: 20%%"/>
+                                        </div>
+                                        <field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}'/>
+                                    </div>
+                                </group>
+                                <field name="supplier" invisible="True"/>
+                            </sheet>
+                        </form>
+                    </field>
+                </page>
+                <page name="personal-info" string="Personal Information" attrs="{'invisible': ['|',('is_company','=',True)]}">
+                    <p attrs="{'invisible': [('contact_id','=',False)]}">
+                        To see personal information about this contact, please go to to the his person form: <field name="contact_id" class="oe_inline" domain="[('contact_type','!=','attached')]" context="{'show_address': 1}"
+                        on_change="onchange_contact_id(contact_id)" options="{'always_reload': True}"/>
+                    </p>
+                    <group attrs="{'invisible': [('contact_id','!=',False)]}">
+                        <field name="birthdate_date"/>
+                        <field name="nationality_id"/>
+                    </group>
+                </page>
+            </page>
+            <xpath expr="//field[@name='child_ids']/form//field[@name='name']/.." position="before">
+                <field name="contact_type" readonly="0" on_change="onchange_contact_type(contact_type)"/>
+            </xpath>
+            <xpath expr="//field[@name='child_ids']/form//field[@name='name']" position="after">
+                <field name="contact_id" on_change="onchange_contact_id(contact_id)" string="Contact"
+                       attrs="{'invisible': [('contact_type','!=','attached')], 'required': [('contact_type','=','attached')]}"/>
+            </xpath>
+            <xpath expr="//field[@name='child_ids']/form//field[@name='name']" position="attributes">
+                <attribute name="attrs">{'invisible': [('contact_type','=','attached')]}</attribute>
+            </xpath>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_res_partner_kanban_contact">
+        <field name="name">res.partner.kanban.contact</field>
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="base.res_partner_kanban_view"/>
+        <field name="arch" type="xml">
+            <field name="is_company" position="after">
+                <field name="other_contact_ids">
+                    <tree>
+                        <field name="parent_id"/>
+                        <field name="function"/>
+                    </tree>
+                </field>
+            </field>
+            <xpath expr="//t[@t-name='kanban-box']//div[@class='oe_kanban_details']/ul/li[3]" position="after">
+                <t t-if="record.other_contact_ids.raw_value.length &gt; 0">
+                    <li>+<t t-esc="record.other_contact_ids.raw_value.length"/>
+                         <t t-if="record.other_contact_ids.raw_value.length == 1">other position</t>
+                         <t t-if="record.other_contact_ids.raw_value.length &gt; 1">other positions</t></li>
+                </t>
+            </xpath>
+        </field>
+    </record>
+
+</data>
+</openerp>

=== added directory 'base_contact/i18n'
=== added file 'base_contact/i18n/base_contact.pot'
--- base_contact/i18n/base_contact.pot	1970-01-01 00:00:00 +0000
+++ base_contact/i18n/base_contact.pot	2014-01-30 15:45:21 +0000
@@ -0,0 +1,184 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* base_contact
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-12-10 16:08+0000\n"
+"PO-Revision-Date: 2013-12-10 11:08-0500\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "City"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "other position"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Contacts"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid ""
+"To see personal information about this contact, please go to to the his "
+"person form:"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Street..."
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "State"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "at"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Tags..."
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Other Positions"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Phone:"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Company"
+msgstr ""
+
+#. module: base_contact
+#: field:res.partner,contact_id:0
+msgid "Main Contact"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Fax:"
+msgstr ""
+
+#. module: base_contact
+#: selection:res.partner,contact_type:0
+msgid "Standalone Contact"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Address"
+msgstr ""
+
+#. module: base_contact
+#: field:res.partner,nationality_id:0
+msgid "Nationality"
+msgstr ""
+
+#. module: base_contact
+#: selection:res.partner,contact_type:0
+msgid "Attached to existing Contact"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "ZIP"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Country"
+msgstr ""
+
+#. module: base_contact
+#: field:res.partner,birthdate_date:0
+msgid "Birthdate"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Person"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Contact"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Mobile:"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "All partner positions"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "{'invisible': [('contact_type','=','attached')]}"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "All positions"
+msgstr ""
+
+#. module: base_contact
+#: model:ir.model,name:base_contact.model_ir_actions_act_window
+msgid "ir.actions.act_window"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "other positions"
+msgstr ""
+
+#. module: base_contact
+#: field:res.partner,contact_type:0
+msgid "Contact Type"
+msgstr ""
+
+#. module: base_contact
+#: model:ir.model,name:base_contact.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: base_contact
+#: field:res.partner,other_contact_ids:0
+msgid "Others Positions"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Personal Information"
+msgstr ""
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "e.g. Sales Director"
+msgstr ""

=== added file 'base_contact/i18n/fr.po'
--- base_contact/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ base_contact/i18n/fr.po	2014-01-30 15:45:21 +0000
@@ -0,0 +1,186 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* base_contact
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-12-10 16:09+0000\n"
+"PO-Revision-Date: 2013-12-10 11:15-0500\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "City"
+msgstr "Ville"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "other position"
+msgstr "Autre fonction"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Contacts"
+msgstr "Contacts"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid ""
+"To see personal information about this contact, please go to to the his "
+"person form:"
+msgstr ""
+"Pour voir des informations personnelles sur ce contact, s'il vous plaît "
+"aller à la sa forme de personne:"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Street..."
+msgstr "Rue..."
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "State"
+msgstr "État"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "at"
+msgstr "à"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Tags..."
+msgstr "Étiquettes..."
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Other Positions"
+msgstr "Autres Fonctions"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Phone:"
+msgstr "Téléphone:"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Company"
+msgstr "Organisme"
+
+#. module: base_contact
+#: field:res.partner,contact_id:0
+msgid "Main Contact"
+msgstr "Contact principal"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Fax:"
+msgstr "Fax :"
+
+#. module: base_contact
+#: selection:res.partner,contact_type:0
+msgid "Standalone Contact"
+msgstr "Contact simple"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Address"
+msgstr "Adresse"
+
+#. module: base_contact
+#: field:res.partner,nationality_id:0
+msgid "Nationality"
+msgstr "Nationalité"
+
+#. module: base_contact
+#: selection:res.partner,contact_type:0
+msgid "Attached to existing Contact"
+msgstr "Attaché à contacter existante"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "ZIP"
+msgstr "Code postal"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Country"
+msgstr "Pays"
+
+#. module: base_contact
+#: field:res.partner,birthdate_date:0
+msgid "Birthdate"
+msgstr "Date de naissance"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Person"
+msgstr "Personne"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Contact"
+msgstr "Contact"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Mobile:"
+msgstr "Portable :"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "All partner positions"
+msgstr "Toutes les fonctions"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "{'invisible': [('contact_type','=','attached')]}"
+msgstr "{'invisible': [('contact_type','=','attached')]}"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "All positions"
+msgstr "Toutes les positions"
+
+#. module: base_contact
+#: model:ir.model,name:base_contact.model_ir_actions_act_window
+msgid "ir.actions.act_window"
+msgstr "ir.actions.act_window"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "other positions"
+msgstr "Autres fonctions"
+
+#. module: base_contact
+#: field:res.partner,contact_type:0
+msgid "Contact Type"
+msgstr "Type de contact"
+
+#. module: base_contact
+#: model:ir.model,name:base_contact.model_res_partner
+msgid "Partner"
+msgstr "Partenaire"
+
+#. module: base_contact
+#: field:res.partner,other_contact_ids:0
+msgid "Others Positions"
+msgstr "Autres fonctions"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "Personal Information"
+msgstr "Informations personnelles"
+
+#. module: base_contact
+#: view:res.partner:0
+msgid "e.g. Sales Director"
+msgstr "e.g. Directeur"

=== added directory 'base_contact/tests'
=== added file 'base_contact/tests/__init__.py'
--- base_contact/tests/__init__.py	1970-01-01 00:00:00 +0000
+++ base_contact/tests/__init__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 ⁻*-
+##############################################################################
+#
+#    OpenERP, Open Source Business Applications
+#    Copyright (C) 2013-TODAY OpenERP S.A. (<http://openerp.com>).
+#
+#    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 . import test_base_contact
+
+checks = [
+    test_base_contact,
+]

=== added file 'base_contact/tests/test_base_contact.py'
--- base_contact/tests/test_base_contact.py	1970-01-01 00:00:00 +0000
+++ base_contact/tests/test_base_contact.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,136 @@
+# -*- coding: utf-8 ⁻*-
+##############################################################################
+#
+#    OpenERP, Open Source Business Applications
+#    Copyright (C) 2013-TODAY OpenERP S.A. (<http://openerp.com>).
+#
+#    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.tests import common
+
+
+class Test_Base_Contact(common.TransactionCase):
+
+    def setUp(self):
+        """*****setUp*****"""
+        super(Test_Base_Contact, self).setUp()
+        cr, uid = self.cr, self.uid
+        ModelData = self.registry('ir.model.data')
+        self.partner = self.registry('res.partner')
+
+        # Get test records reference
+        for attr, module, name in [
+                ('main_partner_id', 'base', 'main_partner'),
+                ('bob_contact_id', 'base_contact', 'res_partner_contact1'),
+                ('bob_job1_id', 'base_contact', 'res_partner_contact1_work_position1'),
+                ('roger_contact_id', 'base', 'res_partner_main2'),
+                ('roger_job2_id', 'base_contact', 'res_partner_main2_position_consultant')]:
+            r = ModelData.get_object_reference(cr, uid, module, name)
+            setattr(self, attr, r[1] if r else False)
+
+    def test_00_show_only_standalone_contact(self):
+        """Check that only standalone contact are shown if context explicitly state to not display all positions"""
+        cr, uid = self.cr, self.uid
+        ctx = {'search_show_all_positions': False}
+        partner_ids = self.partner.search(cr, uid, [], context=ctx)
+        partner_ids.sort()
+        self.assertTrue(self.bob_job1_id not in partner_ids)
+        self.assertTrue(self.roger_job2_id not in partner_ids)
+
+    def test_01_show_all_positions(self):
+        """Check that all contact are show if context is empty or explicitly state to display all positions"""
+        cr, uid = self.cr, self.uid
+
+        partner_ids = self.partner.search(cr, uid, [], context=None)
+        self.assertTrue(self.bob_job1_id in partner_ids)
+        self.assertTrue(self.roger_job2_id in partner_ids)
+
+        ctx = {'search_show_all_positions': True}
+        partner_ids = self.partner.search(cr, uid, [], context=ctx)
+        self.assertTrue(self.bob_job1_id in partner_ids)
+        self.assertTrue(self.roger_job2_id in partner_ids)
+
+    def test_02_reading_other_contact_one2many_show_all_positions(self):
+        """Check that readonly partner's ``other_contact_ids`` return all values whatever the context"""
+        cr, uid = self.cr, self.uid
+
+        def read_other_contacts(pid, context=None):
+            return self.partner.read(cr, uid, [pid], ['other_contact_ids'], context=context)[0]['other_contact_ids']
+
+        def read_contacts(pid, context=None):
+            return self.partner.read(cr, uid, [pid], ['child_ids'], context=context)[0]['child_ids']
+
+        ctx = None
+        self.assertEqual(read_other_contacts(self.bob_contact_id, context=ctx), [self.bob_job1_id])
+        ctx = {'search_show_all_positions': False}
+        self.assertEqual(read_other_contacts(self.bob_contact_id, context=ctx), [self.bob_job1_id])
+        ctx = {'search_show_all_positions': True}
+        self.assertEqual(read_other_contacts(self.bob_contact_id, context=ctx), [self.bob_job1_id])
+
+        ctx = None
+        self.assertTrue(self.bob_job1_id in read_contacts(self.main_partner_id, context=ctx))
+        ctx = {'search_show_all_positions': False}
+        self.assertTrue(self.bob_job1_id in read_contacts(self.main_partner_id, context=ctx))
+        ctx = {'search_show_all_positions': True}
+        self.assertTrue(self.bob_job1_id in read_contacts(self.main_partner_id, context=ctx))
+
+    def test_03_search_match_attached_contacts(self):
+        """Check that searching partner also return partners having attached contacts matching search criteria"""
+        cr, uid = self.cr, self.uid
+        # Bob's contact has one other position which is related to 'Your Company'
+        # so search for all contacts working for 'Your Company' should contain bob position.
+        partner_ids = self.partner.search(cr, uid, [('parent_id', 'ilike', 'Your Company')], context=None)
+        self.assertTrue(self.bob_job1_id in partner_ids)
+
+        # but when searching without 'all positions', we should get the position standalone contact instead.
+        ctx = {'search_show_all_positions': False}
+        partner_ids = self.partner.search(cr, uid, [('parent_id', 'ilike', 'Your Company')], context=ctx)
+        self.assertTrue(self.bob_contact_id in partner_ids)
+
+    def test_04_contact_creation(self):
+        """Check that we're begin to create a contact"""
+        cr, uid = self.cr, self.uid
+
+        # Create a contact using only name
+        new_contact_id = self.partner.create(cr, uid, {'name': 'Bob Egnops'})
+        self.assertEqual(self.partner.browse(cr, uid, new_contact_id).contact_type, 'standalone')
+
+        # Create a contact with only contact_id
+        new_contact_id = self.partner.create(cr, uid, {'contact_id': self.bob_contact_id})
+        new_contact = self.partner.browse(cr, uid, new_contact_id)
+        self.assertEqual(new_contact.name, 'Bob Egnops')
+        self.assertEqual(new_contact.contact_type, 'attached')
+
+        # Create a contact with both contact_id and name;
+        # contact's name should override provided value in that case
+        new_contact_id = self.partner.create(cr, uid, {'contact_id': self.bob_contact_id, 'name': 'Rob Egnops'})
+        self.assertEqual(self.partner.browse(cr, uid, new_contact_id).name, 'Bob Egnops')
+
+        # Reset contact to standalone
+        self.partner.write(cr, uid, [new_contact_id], {'contact_id': False})
+        self.assertEqual(self.partner.browse(cr, uid, new_contact_id).contact_type, 'standalone')
+
+    def test_05_contact_fields_sync(self):
+        """Check that contact's fields are correctly synced between parent contact or related contacts"""
+        cr, uid = self.cr, self.uid
+
+        # Test DOWNSTREAM sync
+        self.partner.write(cr, uid, [self.bob_contact_id], {'name': 'Rob Egnops'})
+        self.assertEqual(self.partner.browse(cr, uid, self.bob_job1_id).name, 'Rob Egnops')
+
+        # Test UPSTREAM sync
+        self.partner.write(cr, uid, [self.bob_job1_id], {'name': 'Bob Egnops'})
+        self.assertEqual(self.partner.browse(cr, uid, self.bob_contact_id).name, 'Bob Egnops')

=== added directory 'base_contact_by_functions'
=== added file 'base_contact_by_functions/__init__.py'
--- base_contact_by_functions/__init__.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/__init__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,27 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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 . import res_partner
+from . import functions
+from . import res_institutions
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions/__openerp__.py'
--- base_contact_by_functions/__openerp__.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/__openerp__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,56 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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': 'Contacts by Functions',
+    'version': '0.1',
+    'author': 'Savoir-faire Linux',
+    'maintainer': 'Savoir-faire Linux',
+    'website': 'http://www.savoirfairelinux.com',
+    'category': 'Customer Relationship Management',
+    'description': """
+Contacts by Functions
+=====================
+
+This module allows you to manage contacts by functions
+
+Contributors
+------------
+* EL Hadji Dem (elhadji.dem@xxxxxxxxxxxxxxxxxxxx)
+""",
+    'depends': [
+        'base_contact',
+    ],
+    'external_dependencies': {},
+    'data': [
+        'functions_view.xml',
+        'res_institutions_view.xml',
+        'res_partner_view.xml',
+        'security/ir.model.access.csv',
+    ],
+    'demo': [],
+    'test': [],
+    'installable': True,
+    'active': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions/functions.py'
--- base_contact_by_functions/functions.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/functions.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,41 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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 import fields, orm
+
+
+class functions(orm.Model):
+    _description = 'Functions'
+    _name = 'functions'
+    _columns = {
+        'name': fields.char('Name', size=256, required=True, select=True,
+                            help='Name of function.'),
+        'acronym': fields.char('Acronym', size=50, help='Acronym of function.'),
+        'partner_ids': fields.many2many('res.partner',
+                                        'function_partner_rel',
+                                        'function_id',
+                                        'partner_id',
+                                        'Functions'),
+        'institution_id': fields.many2one("res.institution", 'institution'),
+    }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions/functions_view.xml'
--- base_contact_by_functions/functions_view.xml	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/functions_view.xml	2014-01-30 15:45:21 +0000
@@ -0,0 +1,38 @@
+<?xml version="1.0" ?>
+<openerp>
+  <data>
+    <!-- Tree Views functions-->
+    <record model="ir.ui.view" id="functions_tree_view">
+      <field name="name">Functions Tree View</field>
+      <field name="model">functions</field>
+      <field name="type">tree</field>
+      <field name="arch" type="xml">
+        <tree string="FunctionsTree" version="7.0">
+           <field name="name"/>
+           <field name="acronym"/>
+        </tree>
+      </field>
+    </record>
+     <!-- Form Views functions-->
+    <record model="ir.ui.view" id="functions_form_view">
+      <field name="name">Functions Form View</field>
+      <field name="model">functions</field>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+        <form string="FunctionsForm" version="7.0" >
+           <group col="4">
+              <field name="name"/>
+              <field name="acronym"/>
+          </group>
+        </form>
+      </field>
+    </record>
+     <!-- Actions -->
+    <record model="ir.actions.act_window" id="action_functions_tree_list">
+        <field name="name">Functions</field>
+        <field name="view_id" ref="functions_tree_view"/>
+        <field name="res_model">functions</field>
+        <field name="view_mode">tree,form</field>
+    </record>
+  </data>
+</openerp>

=== added directory 'base_contact_by_functions/i18n'
=== added file 'base_contact_by_functions/i18n/base_contact_by_functions.pot'
--- base_contact_by_functions/i18n/base_contact_by_functions.pot	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/i18n/base_contact_by_functions.pot	2014-01-30 15:45:21 +0000
@@ -0,0 +1,353 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* base_contact_by_functions
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-28 22:15+0000\n"
+"PO-Revision-Date: 2014-01-28 17:15-0500\n"
+"Last-Translator: EL Hadji DEM <elhadji.dem@xxxxxxxxxxxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: base_contact_by_functions
+#: field:res.category.functions,category_id:0
+msgid "Category"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "City"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:functions,partner_ids:0
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_functions_tree_list
+#: model:ir.model,name:base_contact_by_functions.model_functions
+#: field:res.category.functions,functions_id:0 view:res.institution:0
+#: field:res.institution,institutionfunction_ids:0
+#: field:res.institution.functions,functions_id:0 view:res.partner:0
+#: field:res.partner,functions_ids:0 view:res.partner.category:0
+#: field:res.partner.category,categoryfunction_ids:0
+msgid "Functions"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "History (Functions)"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_institution_functions
+msgid "Institutions functions"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:res.partner,delivered_country:0
+msgid "Country for which a passport is delivered"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_contact_form
+msgid "Contacts"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Street..."
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.institution:0
+msgid "Add functions for this institution"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
+msgid "FunctionsTree"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: sql_constraint:res.institution:0
+msgid "Name already exists"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "State"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:res.category.functions,sequence:0
+#: help:res.institution.functions,sequence:0
+msgid "Used to order"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
+msgid "FunctionsForm"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "e.g. Sales Director"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:functions,acronym:0
+msgid "Acronym of function."
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Tags..."
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,start_date:0
+msgid "Start date"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.institution:0
+msgid "InstitutionsForm"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Fax:"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,expiration_date:0
+msgid "Expiration date"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Function"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Parent Organism"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Zip"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,delivered_country:0
+msgid "Country Passport"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,other_contact_history_ids:0
+msgid "unknown"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_customer_form
+msgid "Company"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_category_functions
+msgid "Categories functions"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:res.institution,name:0
+msgid "Name of institution."
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:res.partner,naming:0
+msgid "Naming."
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Tag"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Passport information"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Address"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Parent organism"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "have the  same form for contact and other postions"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Select functions for this organism"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Phone:"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:functions,name:0 field:res.institution,name:0
+msgid "Name"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "ZIP"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Use organism address"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Country"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:functions,institution_id:0
+msgid "institution"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Is an Organism"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,function_id:0
+msgid "Position Occupied"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Contact"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:res.institution,sequence:0
+msgid "Used to order the institutions"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Mobile:"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_partner_category
+msgid "Partner Categories"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Organism"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_institutions_tree_list
+#: model:ir.model,name:base_contact_by_functions.model_res_institution
+#: field:res.institution.functions,institution_id:0
+msgid "Institutions"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "History"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,end_date:0
+msgid "End date"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner.category:0
+msgid "Add function"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Bank Details"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.institution:0
+msgid "InstitutionsTree"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.category.functions,sequence:0 field:res.institution,sequence:0
+#: field:res.institution.functions,sequence:0
+msgid "Sequence"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Bank Accounts"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "No, Street, Apartment/Office"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Use address organism"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:functions,acronym:0
+msgid "Acronym"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:functions,name:0
+msgid "Name of function."
+msgstr ""
+
+#. module: base_contact_by_functions
+#: help:res.partner,passport_number:0
+msgid "Passport number."
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,passport_number:0
+msgid "Passport Number"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: base_contact_by_functions
+#: field:res.partner,naming:0
+msgid "Naming"
+msgstr ""

=== added file 'base_contact_by_functions/i18n/fr.po'
--- base_contact_by_functions/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/i18n/fr.po	2014-01-30 15:45:21 +0000
@@ -0,0 +1,353 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* base_contact_by_functions
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-29 15:16+0000\n"
+"PO-Revision-Date: 2014-01-29 10:19-0500\n"
+"Last-Translator: EL Hadji DEM <elhadji.dem@xxxxxxxxxxxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: base_contact_by_functions
+#: field:res.category.functions,category_id:0
+msgid "Category"
+msgstr "Catégorie"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "City"
+msgstr "Ville"
+
+#. module: base_contact_by_functions
+#: field:functions,partner_ids:0
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_functions_tree_list
+#: model:ir.model,name:base_contact_by_functions.model_functions
+#: field:res.category.functions,functions_id:0 view:res.institution:0
+#: field:res.institution,institutionfunction_ids:0
+#: field:res.institution.functions,functions_id:0 view:res.partner:0
+#: field:res.partner,functions_ids:0 view:res.partner.category:0
+#: field:res.partner.category,categoryfunction_ids:0
+msgid "Functions"
+msgstr "Fonctions"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "History (Functions)"
+msgstr "Historique (Fonctions)"
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_institution_functions
+msgid "Institutions functions"
+msgstr "Fonctions des institutions"
+
+#. module: base_contact_by_functions
+#: help:res.partner,delivered_country:0
+msgid "Country for which a passport is delivered"
+msgstr "Pays pour lequel le passeport est délivré"
+
+#. module: base_contact_by_functions
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_contact_form
+msgid "Contacts"
+msgstr "Contacts"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Street..."
+msgstr "Rue..."
+
+#. module: base_contact_by_functions
+#: view:res.institution:0
+msgid "Add functions for this institution"
+msgstr "Ajouter des fonctions de cette institution"
+
+#. module: base_contact_by_functions
+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
+msgid "FunctionsTree"
+msgstr "FonctionsTree"
+
+#. module: base_contact_by_functions
+#: sql_constraint:res.institution:0
+msgid "Name already exists"
+msgstr "Le nom existe déjà"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "State"
+msgstr "Etat"
+
+#. module: base_contact_by_functions
+#: help:res.category.functions,sequence:0
+#: help:res.institution.functions,sequence:0
+msgid "Used to order"
+msgstr "Permet d'ordonner"
+
+#. module: base_contact_by_functions
+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
+msgid "FunctionsForm"
+msgstr "FonctionsForm"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "e.g. Sales Director"
+msgstr "ex: Directeur de vente"
+
+#. module: base_contact_by_functions
+#: help:functions,acronym:0
+msgid "Acronym of function."
+msgstr "Acronyme de la fonction."
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Tags..."
+msgstr "Etiquettes..."
+
+#. module: base_contact_by_functions
+#: field:res.partner,start_date:0
+msgid "Start date"
+msgstr "Date de début"
+
+#. module: base_contact_by_functions
+#: view:res.institution:0
+msgid "InstitutionsForm"
+msgstr "InstitutionsForm"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Fax:"
+msgstr "Télécopie :"
+
+#. module: base_contact_by_functions
+#: field:res.partner,expiration_date:0
+msgid "Expiration date"
+msgstr "Date d'expiration"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Function"
+msgstr "Fonction"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Fax"
+msgstr "Télécopie"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Parent Organism"
+msgstr "Organisme parent"
+
+#. module: base_contact_by_functions
+#: field:res.partner,delivered_country:0
+msgid "Country Passport"
+msgstr "Pays de délivrance du passeport"
+
+#. module: base_contact_by_functions
+#: field:res.partner,other_contact_history_ids:0
+msgid "unknown"
+msgstr "inconnu"
+
+#. module: base_contact_by_functions
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_customer_form
+msgid "Company"
+msgstr "Organisme"
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_category_functions
+msgid "Categories functions"
+msgstr "Catégories functions"
+
+#. module: base_contact_by_functions
+#: help:res.institution,name:0
+msgid "Name of institution."
+msgstr "Nom de l'institution."
+
+#. module: base_contact_by_functions
+#: help:res.partner,naming:0
+msgid "Naming."
+msgstr "Appellation"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Tag"
+msgstr "Etiquette"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Passport information"
+msgstr "Informations du passeport"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Address"
+msgstr "Adresse"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Parent organism"
+msgstr "Organisme parent"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "have the  same form for contact and other postions"
+msgstr "Avoir le même formulaire de contact et d'autres postions"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Select functions for this organism"
+msgstr "Sélectionner les fonctions de cet organisme"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Phone:"
+msgstr "Téléphone:"
+
+#. module: base_contact_by_functions
+#: field:functions,name:0 field:res.institution,name:0
+msgid "Name"
+msgstr "Nom"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "ZIP"
+msgstr "Code postal"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Use organism address"
+msgstr "Utilisez l'adresse de l'organisme"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Country"
+msgstr "Pays"
+
+#. module: base_contact_by_functions
+#: field:functions,institution_id:0
+msgid "institution"
+msgstr "institution"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Is an Organism"
+msgstr "Est un Organisme"
+
+#. module: base_contact_by_functions
+#: field:res.partner,function_id:0
+msgid "Position Occupied"
+msgstr "Fonction Occupée"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Contact"
+msgstr "Contact"
+
+#. module: base_contact_by_functions
+#: help:res.institution,sequence:0
+msgid "Used to order the institutions"
+msgstr "Permet d'ordonner les institutions"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Mobile:"
+msgstr "Portable :"
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_partner_category
+msgid "Partner Categories"
+msgstr "Catégories de partenaires"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Organism"
+msgstr "Organisme"
+
+#. module: base_contact_by_functions
+#: model:ir.actions.act_window,name:base_contact_by_functions.action_institutions_tree_list
+#: model:ir.model,name:base_contact_by_functions.model_res_institution
+#: field:res.institution.functions,institution_id:0
+msgid "Institutions"
+msgstr "Institutions"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "History"
+msgstr "Historique"
+
+#. module: base_contact_by_functions
+#: field:res.partner,end_date:0
+msgid "End date"
+msgstr "Date de fin"
+
+#. module: base_contact_by_functions
+#: view:res.partner.category:0
+msgid "Add function"
+msgstr "Ajouter fonction"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Bank Details"
+msgstr "Coordonnées bancaires"
+
+#. module: base_contact_by_functions
+#: view:res.institution:0
+msgid "InstitutionsTree"
+msgstr "InstitutionsTree"
+
+#. module: base_contact_by_functions
+#: field:res.category.functions,sequence:0 field:res.institution,sequence:0
+#: field:res.institution.functions,sequence:0
+msgid "Sequence"
+msgstr "Séquence"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Bank Accounts"
+msgstr "Comptes bancaires"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "No, Street, Apartment/Office"
+msgstr "No, Rue, Appartement/Bureau"
+
+#. module: base_contact_by_functions
+#: view:res.partner:0
+msgid "Use address organism"
+msgstr "Utiliser l'adresse de l'organisme"
+
+#. module: base_contact_by_functions
+#: field:functions,acronym:0
+msgid "Acronym"
+msgstr "Acronyme"
+
+#. module: base_contact_by_functions
+#: help:functions,name:0
+msgid "Name of function."
+msgstr "Nom de la fonction."
+
+#. module: base_contact_by_functions
+#: help:res.partner,passport_number:0
+msgid "Passport number."
+msgstr "Numéro de passeport."
+
+#. module: base_contact_by_functions
+#: field:res.partner,passport_number:0
+msgid "Passport Number"
+msgstr "Numéro de passeport."
+
+#. module: base_contact_by_functions
+#: model:ir.model,name:base_contact_by_functions.model_res_partner
+msgid "Partner"
+msgstr "Partenaire"
+
+#. module: base_contact_by_functions
+#: field:res.partner,naming:0
+msgid "Naming"
+msgstr "Appellation"

=== added file 'base_contact_by_functions/res_institutions.py'
--- base_contact_by_functions/res_institutions.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_institutions.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,49 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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 import fields, orm
+
+
+class res_institutions(orm.Model):
+    _description = 'Institutions'
+    _name = 'res.institution'
+    _order = 'sequence asc'
+    _columns = {
+        'name': fields.char('Name', size=256, required=True, select=True,
+                            help='Name of institution.'),
+        'sequence': fields.integer('Sequence', help="Used to order the institutions"),
+        'institutionfunction_ids': fields.one2many('res.institution.functions', 'institution_id', 'Functions'),
+    }
+    _sql_constraints = [('institution_name_unique', 'unique(name)', 'Name already exists')]
+
+
+class res_institutions_functions(orm.Model):
+    _description = 'Institutions functions'
+    _name = 'res.institution.functions'
+    _order = 'sequence asc'
+    _columns = {
+        'functions_id': fields.many2one('functions', 'Functions', required='True'),
+        'sequence': fields.integer('Sequence', help="Used to order"),
+        'institution_id': fields.many2one('res.institution', 'Institutions'),
+    }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions/res_institutions_view.xml'
--- base_contact_by_functions/res_institutions_view.xml	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_institutions_view.xml	2014-01-30 15:45:21 +0000
@@ -0,0 +1,55 @@
+<?xml version="1.0" ?>
+<openerp>
+  <data>
+    <!-- Tree Views Institutions-->
+    <record model="ir.ui.view" id="institutions_tree_view">
+      <field name="name">Institutions Tree View</field>
+      <field name="model">res.institution</field>
+      <field name="type">tree</field>
+      <field name="arch" type="xml">
+        <tree string="InstitutionsTree" version="7.0">
+           <field name="name"/>
+           <field name="sequence"/>
+        </tree>
+      </field>
+    </record>
+     <!-- Form Views Institutions-->
+    <record model="ir.ui.view" id="institutions_form_view">
+      <field name="name">Institutions Form View</field>
+      <field name="model">res.institution</field>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+        <form string="InstitutionsForm" version="7.0" >
+           <group col="4">
+              <field name="name"/>
+              <field name="sequence"/>
+          </group>
+          <notebook position="inside">
+            <page string="Functions">
+              <separator string="Add functions for this institution"/>
+              <group col="2" colspan="4">
+                <field name="institutionfunction_ids" nolabel="1">
+                  <tree string="FunctionsTree">
+                    <field name="sequence"/>
+                    <field name="functions_id"/>
+                  </tree>
+                  <form string="FunctionsForm">
+                    <field name="functions_id"/>
+                    <field name="sequence"/>
+                  </form>
+                </field>
+              </group>
+            </page>
+          </notebook>
+        </form>
+      </field>
+    </record>
+     <!-- Actions -->
+    <record model="ir.actions.act_window" id="action_institutions_tree_list">
+        <field name="name">Institutions</field>
+        <field name="view_id" ref="institutions_tree_view"/>
+        <field name="res_model">res.institution</field>
+        <field name="view_mode">tree,form</field>
+    </record>
+  </data>
+</openerp>

=== added file 'base_contact_by_functions/res_partner.py'
--- base_contact_by_functions/res_partner.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_partner.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,107 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import orm, fields
+
+
+class res_partner_category(orm.Model):
+    """
+    Inherits partner_category
+    """
+    _inherit = 'res.partner.category'
+    _columns = {
+        'categoryfunction_ids': fields.one2many('res.category.functions', 'category_id', 'Functions'),
+    }
+
+
+class res_category_functions(orm.Model):
+    """
+    Adds this class to link category and functions
+    """
+    _description = 'Categories functions'
+    _name = 'res.category.functions'
+    _order = 'sequence asc'
+    _columns = {
+        'functions_id': fields.many2one('functions', 'Functions', required='True'),
+        'sequence': fields.integer('Sequence', help="Used to order"),
+        'category_id': fields.many2one('res.partner.category', 'Category'),
+    }
+
+
+class res_partner(orm.Model):
+    """
+    Inherits partner and adds functions_ids : List of functions
+    """
+    _inherit = 'res.partner'
+
+    def onchange_partner_function(self, cr, uid, ids, part, context=None):
+        if not part:
+            return {'value': None}
+        partner_ids = self.pool.get('res.partner').search(cr, uid, [('id', '=', part)])
+        functions_ids = self.pool.get('res.partner').browse(cr, uid, partner_ids, context=context)[0].functions_ids
+        result = []
+        if functions_ids:
+            for line in functions_ids:
+                result.append(line.id)
+        dom = {'function_id': [('id', 'in', result)]}
+        return {'domain': dom}
+
+    def _get_history_lines(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        res_partner_pool = self.pool.get('res.partner')
+        for record in self.browse(cr, uid, ids, context=context):
+
+            if record.is_company:
+                return res
+            contact_ids = res_partner_pool.search(cr, uid,
+                                                  [('contact_id', '=', record.id),
+                                                   ('active', '=', False)],
+                                                  context=context)
+            res[record.id] = [x.id for x in res_partner_pool.browse(cr, uid, contact_ids)
+                              if x.end_date and x.end_date <= time.strftime('%Y-%m-%d')]
+        return res
+
+    _columns = {
+        'functions_ids': fields.many2many('functions', 'function_partner_rel', 'partner_id',
+                                          'function_id', 'Functions'),
+        'delivered_country': fields.many2one('res.country', 'Country Passport',
+                                             help='Country for which a passport is delivered'),
+        'passport_number': fields.char('Passport Number', size=256,
+                                       help="Passport number."),
+        'expiration_date': fields.date('Expiration date'),
+        'start_date': fields.date('Start date'),
+        'end_date': fields.date('End date'),
+        'naming': fields.char('Naming', size=256, help="Naming."),
+        'function_id': fields.many2one('functions', 'Position Occupied'),
+        'other_contact_history_ids': fields.function(_get_history_lines,
+                                                     relation="res.partner",
+                                                     method=True,
+                                                     type="one2many"),
+        # Replace company by Organism
+        'use_parent_address': fields.boolean(
+            'Use Organism Address',
+            help="Select this if you want to set organism's address information  for this contact"),
+
+    }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions/res_partner_view.xml'
--- base_contact_by_functions/res_partner_view.xml	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_partner_view.xml	2014-01-30 15:45:21 +0000
@@ -0,0 +1,540 @@
+<?xml version = "1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <!--Add list of functions in partner view-->
+    <record id="view_contact_by_function_form" model="ir.ui.view">
+      <field name="name">contact.functions.form.inherit</field>
+      <field name="model">res.partner</field>
+      <field name="inherit_id" ref="base.view_partner_form"/>
+      <field name="arch" type="xml">
+        <field name="use_parent_address" position="replace">
+          <field name="use_parent_address"
+                 class="oe_edit_only oe_inline"
+                 on_change="onchange_address(use_parent_address, parent_id)"
+                 attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"
+                 string="Use organism address"/>
+        </field>
+        <label for="use_parent_address" position="replace">
+             <label for="use_parent_address"
+                    class="oe_edit_only"
+                    attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"
+                    string="Use organism address"/>
+        </label>
+        <!--Add ')' at the end of 'Is an Organism?'-->
+        <label for="is_company" position="replace">
+             <label for="is_company" string="Is an Organism"/>)
+        </label>
+        <!--Replace Street placeholder by No, Street, Apartment/Office-->
+        <field name="street" position="attributes">
+          <attribute name="placeholder">No, Street, Apartment/Office</attribute>
+        </field>
+        <field name="fax" position="attributes">
+          <attribute name="string">Fax</attribute>
+        </field>
+
+        <notebook position="inside">
+          <page string="Functions"
+                attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}"
+                autofocus="autofocus">
+            <separator string="Select functions for this organism"/>
+            <field name="functions_ids"/>
+          </page>
+          <page string="History (Functions)" attrs="{'invisible': ['|','|',('is_company','=',True),('contact_id','!=',False),('other_contact_history_ids','=',[])]}">
+            <separator string="History"/>
+            <field name="other_contact_history_ids" mode="kanban"
+                   attrs="{'invisible': [('other_contact_history_ids','=',False)]}">
+              <kanban>
+                <field name="color"/>
+                <field name="name"/>
+                <field name="title"/>
+                <field name="email"/>
+                <field name="parent_id" string="Organism"/>
+                <field name="is_company"/>
+                <field name="function_id" string="Function"/>
+                <field name="phone"/>
+                <field name="street"/>
+                <field name="street2"/>
+                <field name="zip"/>
+                <field name="city"/>
+                <field name="country_id"/>
+                <field name="mobile"/>
+                <field name="fax"/>
+                <field name="state_id"/>
+                <field name="has_image"/>
+                <templates>
+                  <t t-name="kanban-box">
+                    <div class="oe_kanban_vignette oe_semantic_html_override">
+                      <a type="open">
+                        <t t-if="record.has_image.raw_value === true">
+                          <img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)"
+                               class="oe_kanban_image"/>
+                        </t>
+                        <t t-if="record.has_image.raw_value === false">
+                          <t t-if="record.is_company.raw_value === true">
+                            <img t-att-src='_s + "/base/static/src/img/company_image.png"'
+                               class="oe_kanban_image"/>
+                          </t>
+                          <t t-if="record.is_company.raw_value === false">
+                            <img t-att-src='_s + "/base/static/src/img/avatar.png"'
+                              class="oe_kanban_image"/>
+                          </t>
+                        </t>
+                      </a>
+                      <div class="oe_kanban_details">
+                        <h4 class="oe_partner_heading">
+                          <a type="open">
+                            <field name="name"/>
+                          </a>
+                        </h4>
+                        <div class="oe_kanban_partner_categories"/>
+                        <div class="oe_kanban_partner_links"/>
+                        <ul>
+                          <li t-if="!record.parent_id.raw_value and record.function_id.raw_value">
+                            <field name="function_id"/>
+                          </li>
+                          <li t-if="record.parent_id.raw_value and record.function_id.raw_value">
+                            <field name="function_id"/>
+                            ,
+                            <field name="parent_id"/>
+                          </li>
+                          <li t-if="record.city.raw_value and !record.country.raw_value">
+                            <field name="city"/>
+                          </li>
+                          <li t-if="!record.city.raw_value and record.country.raw_value">
+                            <field name="country"/>
+                          </li>
+                          <li t-if="record.city.raw_value and record.country.raw_value">
+                            <field name="city"/>
+                            ,
+                            <field name="country"/>
+                          </li>
+                          <li t-if="record.email.raw_value">
+                            <a t-attf-href="mailto:#{record.email.raw_value}";>
+                              <field name="email"/>
+                            </a>
+                          </li>
+                        </ul>
+                    </div>
+                    </div>
+                  </t>
+                </templates>
+              </kanban>
+              <form string="Contact" version="7.0">
+                <sheet>
+                  <field name="image" widget='image' class="oe_avatar oe_left"
+                         options='{"preview_image": "image_medium"}'/>
+                  <div class="oe_title">
+                      <label for="name" class="oe_edit_only"/>
+                        <h1>
+                          <field name="name" style="width: 70%%"/>
+                        </h1>
+                  </div>
+                  <group>
+                    <!-- inherited part -->
+                    <field name="category_id" widget="many2many_tags"
+                           placeholder="Tags..." style="width: 70%%" string="Tag"/>
+                    <field name="parent_id"
+                           placeholder="Organism"
+                           domain="[('is_company','=',True)]"
+                           string="Parent Organism"/>
+                    <!-- inherited part end -->
+                    <field name="function_id" placeholder="e.g. Sales Director"/>
+                    <group colspan="4">
+                      <field name="start_date" />
+                      <field name="end_date"/>
+                      <field name="naming"/>
+                    </group>
+                    <field name="email"/>
+                    <field name="phone"/>
+                    <field name="mobile"/>
+                  </group>
+                  <div>
+                      <field name="use_parent_address"/>
+                      <label for="use_parent_address" string="Use organism address"/>
+                  </div>
+                  <group>
+                    <label for="type"/>
+                    <div name="div_type">
+                        <field class="oe_inline" name="type"/>
+                    </div>
+                    <label for="street" string="Address"
+                           attrs="{'invisible': [('use_parent_address','=', True)]}"/>
+                    <div attrs="{'invisible': [('use_parent_address','=', True)]}"
+                         name="div_address">
+                        <field name="street" placeholder="Street..."/>
+                        <field name="street2"/>
+                        <div class="address_format">
+                          <field name="city" placeholder="City" style="width: 40%%"/>
+                          <field name="state_id" class="oe_no_button"
+                                 placeholder="State" style="width: 37%%"
+                                 options='{"no_open": True}' on_change="onchange_state(state_id)"/>
+                          <field name="zip" placeholder="ZIP" style="width: 20%%"/>
+                        </div>
+                        <field name="country_id" placeholder="Country"
+                               class="oe_no_button" options='{"no_open": True}'/>
+                    </div>
+                  </group>
+                  <field name="supplier" invisible="True"/>
+                  <group string="Bank Accounts">
+                    <field name="bank_ids" nolabel="1">
+                      <tree string="Bank Details">
+                          <field name="state" invisible="1"/>
+                          <field name="sequence" invisible="1"/>
+                          <field name="acc_number"/>
+                          <field name="bank_name"/>
+                          <field name="owner_name"/>
+                      </tree>
+                    </field>
+                  </group>
+                </sheet>
+              </form>
+            </field>
+          </page>
+        </notebook>
+        <!--Replace function by function_id defined by organism-->
+        <field name="function" position="replace"/>
+      </field>
+
+    </record>
+    <!--Add  passportnumber, deleverycoubtry, expiredDate in partner view-->
+    <record id="view_passport_info_form" model="ir.ui.view">
+      <field name="name">passport.info.form.inherit</field>
+      <field name="model">res.partner</field>
+      <field name="inherit_id" ref="base_contact.view_partner_form_inherit"/>
+      <field name="arch" type="xml">
+        <page name="personal-info" position="inside">
+          <group string="Passport information" col="6">
+            <field name="passport_number" />
+            <field name="delivered_country"/>
+            <field name="expiration_date"/>
+          </group>
+        </page>
+      </field>
+    </record>
+    <!--Add  start_date, end_date, naming and account bank in partner view-->
+    <record id="view_position_info_form" model="ir.ui.view">
+      <field name="name">position.info.form.inherit</field>
+      <field name="model">res.partner</field>
+      <field name="inherit_id" ref="base_contact.view_partner_form_inherit"/>
+      <field name="arch" type="xml">
+        <xpath expr="//field[@name='other_contact_ids']/form//field[@name='category_id']"
+                 position="attributes">
+          <attribute name="string">Tag</attribute>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']"
+               position="after">
+          <group colspan="4">
+            <field name="start_date" />
+            <field name="end_date"/>
+             <field name="naming"/>
+          </group>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/form//field[@name='supplier']"
+               position="after">
+          <group string="Bank Accounts">
+            <field name="bank_ids" nolabel="1"/>
+          </group>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/form//field[@name='parent_id']"
+               position="replace">
+          <group colspan="4">
+            <field name="parent_id" placeholder="Organism"
+                   domain="[('is_company','=',True)]"
+                   on_change="onchange_partner_function(parent_id)"
+                   string="Parent Organism"/>
+          </group>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']"
+               position="replace">
+          <group colspan="4">
+            <field name="function_id" string="Function"/>
+          </group>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/form//label[@for='use_parent_address']"
+               position="replace">
+          <label for="use_parent_address" string="Use address organism"/>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='function']"
+               position="replace">
+          <group colspan="4">
+            <field name="function_id" string="Function"/>
+          </group>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']"
+               position="after">
+          <templates>
+            <t t-name="kanban-box">
+              <t t-set="color" t-value="kanban_color(record.color.raw_value)"/>
+              <div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')"
+                   style="position: relative">
+                <a t-if="! read_only_mode" type="delete"
+                   style="position: absolute; right: 0; padding: 4px; diplay: inline-block">
+                  X
+                </a>
+                <div class="oe_module_vignette">
+                  <a type="open">
+                    <t t-if="record.has_image.raw_value === true">
+                      <img t-att-src="kanban_image('res.partner', 'image',
+                        record.id.value, {'preview_image': 'image_small'})"
+                           class="oe_avatar oe_kanban_avatar_smallbox"/>
+                    </t>
+                    <t t-if="record.image and record.image.raw_value !== false">
+                      <img t-att-src="'data:image/png;base64,'+record.image.raw_value"
+                           class="oe_avatar oe_kanban_avatar_smallbox"/>
+                    </t>
+                    <t t-if="record.has_image.raw_value === false
+                      and (!record.image or record.image.raw_value === false)">
+                      <t t-if="record.is_company.raw_value === true">
+                        <img t-att-src='_s + "/base/static/src/img/company_image.png"'
+                             class="oe_kanban_image oe_kanban_avatar_smallbox"/>
+                      </t>
+                      <t t-if="record.is_company.raw_value === false">
+                        <img t-att-src='_s + "/base/static/src/img/avatar.png"'
+                             class="oe_kanban_image oe_kanban_avatar_smallbox"/>
+                      </t>
+                    </t>
+                  </a>
+                  <div class="oe_module_desc">
+                    <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border">
+                      <table class="oe_kanban_table">
+                        <tr>
+                          <td class="oe_kanban_title1" align="left" valign="middle">
+                            <h4>
+                              <a type="open">
+                                <field name="name"/>
+                              </a>
+                            </h4>
+                            <i>
+                              <t t-if="record.parent_id.raw_value and !record.function_id.raw_value">
+                                <field name="parent_id"/>
+                              </t>
+                              <t t-if="!record.parent_id.raw_value and record.function_id.raw_value">
+                                <field name="function_id"/>
+                              </t>
+                              <t t-if="record.parent_id.raw_value and record.function_id.raw_value">
+                                <field name="function_id"/>
+                                ,
+                                <field name="parent_id"/>
+                              </t>
+                            </i>
+                            <div>
+                              <a t-if="record.email.raw_value" title="Mail"
+                                 t-att-href="'mailto:'+record.email.value">
+                                <field name="email"/>
+                              </a>
+                            </div>
+                            <div t-if="record.phone.raw_value">
+                              Phone: <field name="phone"/>
+                            </div>
+                            <div t-if="record.mobile.raw_value">
+                              Mobile: <field name="mobile"/>
+                            </div>
+                            <div t-if="record.fax.raw_value">
+                              Fax: <field name="fax"/>
+                            </div>
+                          </td>
+                        </tr>
+                      </table>
+                    </div>
+                  </div>
+                </div>
+              </div>
+            </t>
+          </templates>
+        </xpath>
+        have the  same form for contact and other postions
+        <field name="parent_id" position="replace">
+            <field name="parent_id" placeholder="Organism"
+                   domain="[('is_company','=',True)]"
+                   attrs="{'invisible': [('is_company','=', False)]}"/>
+        </field>
+        <xpath expr="//field[@name='child_ids']/form//field[@name='supplier']"
+               position="after">
+          <group string="Bank Accounts">
+            <field name="bank_ids" nolabel="1"/>
+          </group>
+        </xpath>
+
+        <xpath expr="//field[@name='child_ids']/form//field[@name='function']"
+               position="after">
+          <group colspan="4">
+            <field name="start_date" />
+            <field name="end_date"/>
+             <field name="naming"/>
+          </group>
+        </xpath>
+        <xpath expr="//field[@name='child_ids']/form//field[@name='function']"
+               position="replace">
+          <group colspan="4">
+            <field name="parent_id"
+                   placeholder="Organism"
+                   domain="[('is_company','=',True)]"
+                   string="Parent organism" />
+            <field name="function_id"
+                   readonly="False"
+                   domain="[('id', 'in', parent.functions_ids[0][2])]"
+                   string="Function"/>
+          </group>
+        </xpath>
+
+        <xpath expr="//field[@name='child_ids']/form//label[@for='use_parent_address']"
+               position="replace">
+          <label for="use_parent_address" string="Use address organism"/>
+        </xpath>
+
+        <xpath expr="//field[@name='child_ids']/kanban//field[@name='function']"
+               position="replace">
+          <group colspan="4">
+            <field name="function_id" string="Function"/>
+          </group>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']"
+               position="after">
+          <templates>
+            <t t-name="kanban-box">
+              <div class="oe_kanban_vignette oe_semantic_html_override">
+                <a type="open">
+                  <t t-if="record.has_image.raw_value === true">
+                    <img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)"
+                         class="oe_kanban_image"/>
+                  </t>
+                  <t t-if="record.has_image.raw_value === false">
+                    <t t-if="record.is_company.raw_value === true">
+                      <img t-att-src='_s + "/base/static/src/img/company_image.png"'
+                         class="oe_kanban_image"/>
+                    </t>
+                    <t t-if="record.is_company.raw_value === false">
+                      <img t-att-src='_s + "/base/static/src/img/avatar.png"'
+                        class="oe_kanban_image"/>
+                    </t>
+                  </t>
+                </a>
+                <div class="oe_kanban_details">
+                  <h4 class="oe_partner_heading">
+                    <a type="open">
+                      <field name="name"/>
+                    </a>
+                  </h4>
+                  <div class="oe_kanban_partner_categories"/>
+                  <div class="oe_kanban_partner_links"/>
+                  <ul>
+                    <li t-if="record.parent_id.raw_value and !record.function_id.raw_value">
+                      <field name="parent_id"/>
+                    </li>
+                    <li t-if="!record.parent_id.raw_value and record.function_id.raw_value">
+                      <field name="function_id"/>
+                    </li>
+                    <li t-if="record.parent_id.raw_value and record.function_id.raw_value">
+                      <field name="function_id"/>
+                      ,
+                      <field name="parent_id"/>
+                    </li>
+                    <li t-if="record.city.raw_value and !record.country.raw_value">
+                      <field name="city"/>
+                    </li>
+                    <li t-if="!record.city.raw_value and record.country.raw_value">
+                      <field name="country"/>
+                    </li>
+                    <li t-if="record.city.raw_value and record.country.raw_value">
+                      <field name="city"/>
+                      ,
+                      <field name="country"/>
+                    </li>
+                    <li t-if="record.email.raw_value">
+                      <a t-attf-href="mailto:#{record.email.raw_value}";>
+                        <field name="email"/>
+                      </a>
+                    </li>
+                  </ul>
+              </div>
+              </div>
+            </t>
+          </templates>
+        </xpath>
+      </field>
+    </record>
+    <!-- Actions for organism -->
+    <record id="action_partner_customer_form" model="ir.actions.act_window">
+            <field name="name">Company</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">res.partner</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">kanban,tree,form</field>
+            <field name="domain">[('is_company','=',1)]</field>
+            <field name="filter" eval="True"/>
+        </record>
+    <!-- Actions for Contacts -->
+    <record id="action_partner_contact_form" model="ir.actions.act_window">
+            <field name="name">Contacts</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">res.partner</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">kanban,tree,form</field>
+            <field name="domain">[('is_company','=',0)]</field>
+            <field name="filter" eval="True"/>
+        </record>
+
+    <!--Add country,street fields in tree partner view-->
+    <record model="ir.ui.view" id="view_partner_tree_country_address">
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="base.view_partner_tree"/>
+        <field name="arch" type="xml">
+          <field name="country_id" position="replace"/>
+          <field name="name" position="after">
+            <field name="country_id"/>
+          </field>
+          <field name="email" position="after">
+              <field name="street" string="Address"/>
+          </field>
+        </field>
+    </record>
+
+    <!-- Inherit Categories adding functions -->
+    <record id="view_partner_category_functions_form" model="ir.ui.view">
+      <field name="name">Partner Categories Functions</field>
+      <field name="model">res.partner.category</field>
+      <field name="inherit_id" ref="base.view_partner_category_form"/>
+      <field name="arch" type="xml">
+        <xpath expr="//form[@string='Partner Category']/group[1]"
+               position="after">
+          <notebook position="inside">
+            <page string="Functions">
+              <separator string="Add function"/>
+              <group col="2" colspan="4">
+                <field name="categoryfunction_ids" nolabel="1">
+                  <tree string="FunctionsTree">
+                    <field name="sequence"/>
+                    <field name="functions_id"/>
+                  </tree>
+                  <form string="FunctionsForm">
+                    <field name="functions_id"/>
+                    <field name="sequence"/>
+                  </form>
+                </field>
+              </group>
+            </page>
+          </notebook>
+        </xpath>
+      </field>
+    </record>
+
+      <!--Replace company  by organism-->
+    <record id="view_partner_simple_form" model="ir.ui.view">
+        <field name="name">res.partner.simplified.form</field>
+        <field name="model">res.partner</field>
+        <field name="arch" type="xml">
+          <label for="is_company" position="replace">
+               <label for="is_company" string="Is an Organism"/>
+          </label>
+          <field name="parent_id" position="replace">
+               <field name="parent_id"
+                      placeholder="Organism"
+                      domain="[('is_company', '=', True)]"
+                      context="{'default_is_company': True, 'default_supplier': supplier}"
+                      attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}"
+                      on_change="onchange_address(use_parent_address, parent_id)"/>
+                </field>
+          </field>
+    </record>
+  </data>
+</openerp>

=== added directory 'base_contact_by_functions/security'
=== added file 'base_contact_by_functions/security/ir.model.access.csv'
--- base_contact_by_functions/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/security/ir.model.access.csv	2014-01-30 15:45:21 +0000
@@ -0,0 +1,5 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_functions","functions_user","model_functions","base.group_user",1,1,1,1
+"access_res_category_functions","access_res_category_functions_user","model_res_category_functions","base.group_user",1,1,1,1
+"access_res_institution","access_res_institution_user","model_res_institution","base.group_user",1,1,1,1
+"access_res_institution_functions","access_res_institution_functions_user","model_res_institution_functions","base.group_user",1,1,1,1

=== added directory 'base_contact_by_functions/tests'
=== added file 'base_contact_by_functions/tests/__init__.py'
--- base_contact_by_functions/tests/__init__.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/__init__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,31 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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 . import test_functions
+from . import test_institutions
+from . import test_partner_category
+
+checks = [
+    test_functions,
+    test_institutions,
+    test_partner_category
+]

=== added file 'base_contact_by_functions/tests/test_functions.py'
--- base_contact_by_functions/tests/test_functions.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/test_functions.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,98 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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.tests.common import TransactionCase
+from openerp.osv.orm import browse_record
+
+
+class Base_Test_function(TransactionCase):
+    """
+    Simple test creating a function
+    This is a base class for function test cases.
+    Inherit from this and setup values.
+    """
+
+    def setUp(self, vals={}):
+        """
+        Setting up function.
+        """
+        # Default test values
+        self.vals = {'name': 'This is a test function name',
+                     'acronym': 'This is a test function acronym',
+                     }
+        super(Base_Test_function, self).setUp()
+        self.vals = dict(self.vals.items() + vals.items())
+        # Create the function object; we will be testing this, so store in self
+        function_function = self.registry('functions')
+        self.function_id = function_function.create(self.cr, self.uid, self.vals, context=None)
+
+    def test_function(self):
+        """
+        Checking the function creation.
+        """
+        function_function = self.registry('functions')
+        function_obj = function_function.browse(self.cr, self.uid, self.function_id, context=None)
+        for field in self.vals:
+            val = function_obj[field]
+            if type(val) == browse_record:
+                self.assertEquals(self.vals[field], val.id,
+                                  "IDs for %s don't match: (%i != %i)" %
+                                  (field, self.vals[field], val.id))
+            else:
+                self.assertEquals(str(self.vals[field]), str(val),
+                                  "Values for %s don't match: (%s != %s)" %
+                                  (field, str(self.vals[field]), str(val)))
+
+
+class Test_function_bad(Base_Test_function):
+    """
+    Simple test creating a function, test against bad values
+    """
+    def setUp(self):
+        """
+        Setting up function, then changing the values to test against.
+        """
+        super(Test_function_bad, self).setUp()
+        # Change vals to something wrong
+        self.vals = {'name': 'This is the wrong function name',
+                     'acronym': 'This is the wrong function acronym',
+                     }
+
+    def test_function(self):
+        """
+        Checking the function creation, assertions should all be false.
+        """
+        function_function = self.registry('functions')
+        function_obj = function_function.browse(self.cr, self.uid, self.function_id, context=None)
+        for field in self.vals:
+            val = function_obj[field]
+            if type(val) == browse_record:
+                self.assertNotEqual(self.vals[field], val.id,
+                                    "IDs for %s don't match: (%i != %i)" %
+                                    (field, self.vals[field], val.id))
+            else:
+                self.assertNotEqual(str(self.vals[field]), str(val),
+                                    "Values for %s don't match: (%s != %s)" %
+                                    (field, str(self.vals[field]), str(val)))
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions/tests/test_institutions.py'
--- base_contact_by_functions/tests/test_institutions.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/test_institutions.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,99 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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.tests.common import TransactionCase
+from openerp.osv.orm import browse_record
+
+
+class Base_Test_institution(TransactionCase):
+    """
+    Simple test creating a institution
+    This is a base class for institution test cases.
+    Inherit from this and setup values.
+    """
+
+    def setUp(self, vals={}):
+        """
+        Setting up institution.
+        """
+        # Default test values
+        self.vals = {'name': 'This is a test institution name',
+                     'sequence': '1',
+                     'institutionfunction_ids': '[]',
+                     }
+        super(Base_Test_institution, self).setUp()
+        self.vals = dict(self.vals.items() + vals.items())
+        # Create the institution object; we will be testing this, so store in self
+        institution_institution = self.registry('res.institution')
+        self.institution_id = institution_institution.create(self.cr, self.uid, self.vals, context=None)
+
+    def test_institution(self):
+        """
+        Checking the institution creation.
+        """
+        institution_institution = self.registry('res.institution')
+        institution_obj = institution_institution.browse(self.cr, self.uid, self.institution_id, context=None)
+        for field in self.vals:
+            val = institution_obj[field]
+            if type(val) == browse_record:
+                self.assertEquals(self.vals[field], val.id,
+                                  "IDs for %s don't match: (%i != %i)" %
+                                  (field, self.vals[field], val.id))
+            else:
+                self.assertEquals(str(self.vals[field]), str(val),
+                                  "Values for %s don't match: (%s != %s)" %
+                                  (field, str(self.vals[field]), str(val)))
+
+
+class Test_institution_bad(Base_Test_institution):
+    """
+    Simple test creating a institution, test against bad values
+    """
+    def setUp(self):
+        """
+        Setting up institution, then changing the values to test against.
+        """
+        super(Test_institution_bad, self).setUp()
+        # Change vals to something wrong
+        self.vals = {'name': 'This is the wrong institution name',
+                     'sequence': '0',
+                     }
+
+    def test_institution(self):
+        """
+        Checking the institution creation, assertions should all be false.
+        """
+        institution_institution = self.registry('res.institution')
+        institution_obj = institution_institution.browse(self.cr, self.uid, self.institution_id, context=None)
+        for field in self.vals:
+            val = institution_obj[field]
+            if type(val) == browse_record:
+                self.assertNotEqual(self.vals[field], val.id,
+                                    "IDs for %s don't match: (%i != %i)" %
+                                    (field, self.vals[field], val.id))
+            else:
+                self.assertNotEqual(str(self.vals[field]), str(val),
+                                    "Values for %s don't match: (%s != %s)" %
+                                    (field, str(self.vals[field]), str(val)))
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions/tests/test_partner_category.py'
--- base_contact_by_functions/tests/test_partner_category.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/test_partner_category.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,105 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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.tests.common import TransactionCase
+from openerp.osv.orm import browse_record
+
+
+class Base_Test_partner_category(TransactionCase):
+    """
+    Simple test creating a partner_category
+    This is a base class for partner_category test cases.
+    Inherit from this and setup values.
+    """
+
+    def setUp(self, vals={}):
+        """
+        Setting up partner_category.
+        """
+        # Default test values
+        self.vals = {'name': 'This is a test partner_category name',
+                     'active': True,
+                     }
+        super(Base_Test_partner_category, self).setUp()
+        # Create the parent
+        partner_category_partner = self.registry('res.partner.category')
+        self.vals['parent_id'] = partner_category_partner.create(self.cr, self.uid, {
+            'name': 'Test parent',
+            'active': True, }, context=None)
+
+        self.vals = dict(self.vals.items() + vals.items())
+        # Create the partner_category object; we will be testing this, so store in self
+        self.partner_category_id = partner_category_partner.create(self.cr, self.uid, self.vals, context=None)
+
+    def test_partner_category(self):
+        """
+        Checking the partner_category creation.
+        """
+        partner_category = self.registry('res.partner.category')
+        partner_category_obj = partner_category.browse(self.cr, self.uid, self.partner_category_id, context=None)
+        for field in self.vals:
+            val = partner_category_obj[field]
+            if type(val) == browse_record:
+                self.assertEquals(self.vals[field], val.id,
+                                  "IDs for %s don't match: (%i != %i)" %
+                                  (field, self.vals[field], val.id))
+            else:
+                self.assertEquals(str(self.vals[field]), str(val),
+                                  "Values for %s don't match: (%s != %s)" %
+                                  (field, str(self.vals[field]), str(val)))
+
+
+class Test_partner_category_bad(Base_Test_partner_category):
+    """
+    Simple test creating a partner_category, test against bad values
+    """
+    def setUp(self):
+        """
+        Setting up partner_category, then changing the values to test against.
+        """
+        super(Test_partner_category_bad, self).setUp()
+        # Change vals to something wrong
+        self.vals = {'name': 'This is the wrong partner_category name',
+                     'active': False,
+                     }
+
+    def test_partner_category(self):
+        """
+        Checking the partner_category creation, assertions should all be false.
+        """
+        partner_category_partner_category = self.registry('res.partner.category')
+        partner_category_obj = partner_category_partner_category.browse(self.cr, self.uid,
+                                                                        self.partner_category_id,
+                                                                        context=None)
+        for field in self.vals:
+            val = partner_category_obj[field]
+            if type(val) == browse_record:
+                self.assertNotEqual(self.vals[field], val.id,
+                                    "IDs for %s don't match: (%i != %i)" %
+                                    (field, self.vals[field], val.id))
+            else:
+                self.assertNotEqual(str(self.vals[field]), str(val),
+                                    "Values for %s don't match: (%s != %s)" %
+                                    (field, str(self.vals[field]), str(val)))
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added directory 'base_contact_by_functions_partner_firstname'
=== added file 'base_contact_by_functions_partner_firstname/__init__.py'
--- base_contact_by_functions_partner_firstname/__init__.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/__init__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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/>.
+#
+##############################################################################
+
+import res_partner
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions_partner_firstname/__openerp__.py'
--- base_contact_by_functions_partner_firstname/__openerp__.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/__openerp__.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,53 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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': 'Contacts by Functions - Partner Firstname Bindings',
+    'version': '0.1',
+    'category': 'Customer Relationship Management',
+    'summary': 'Contacts by Functions - Partner Firstname Bindings',
+    'description': """
+Contacts by Functions - Partner Firstname Bindings
+==================================================
+
+Contributors
+------------
+* El Hadji Dem (elhadji.dem@xxxxxxxxxxxxxxxxxxxx)
+""",
+    'author': 'Savoir-faire Linux',
+    'website': 'www.savoirfairelinux.com',
+    'license': 'AGPL-3',
+    'depends': [
+        'base_contact_by_functions',
+        'partner_firstname',
+    ],
+    'data': [
+        'res_partner_view.xml',
+    ],
+    'test': [],
+    'demo': [
+    ],
+    'installable': True,
+    'auto_install': True,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added directory 'base_contact_by_functions_partner_firstname/i18n'
=== added file 'base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot'
--- base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot	2014-01-30 15:45:21 +0000
@@ -0,0 +1,27 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* base_contact_by_functions_partner_firstname
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-03 07:16+0000\n"
+"PO-Revision-Date: 2014-01-03 02:17-0500\n"
+"Last-Translator: EL Hadji DEM <elhadji.dem@xxxxxxxxxxxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: base_contact_by_functions_partner_firstname
+#: view:res.partner:0
+msgid "lastname"
+msgstr ""
+
+#. module: base_contact_by_functions_partner_firstname
+#: view:res.partner:0
+msgid "Firstname"
+msgstr ""

=== added file 'base_contact_by_functions_partner_firstname/i18n/fr.po'
--- base_contact_by_functions_partner_firstname/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/i18n/fr.po	2014-01-30 15:45:21 +0000
@@ -0,0 +1,27 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* base_contact_by_functions_partner_firstname
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-03 07:17+0000\n"
+"PO-Revision-Date: 2014-01-03 02:18-0500\n"
+"Last-Translator: EL Hadji DEM <elhadji.dem@xxxxxxxxxxxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: base_contact_by_functions_partner_firstname
+#: view:res.partner:0
+msgid "lastname"
+msgstr "Nom"
+
+#. module: base_contact_by_functions_partner_firstname
+#: view:res.partner:0
+msgid "Firstname"
+msgstr "Prénom"

=== added file 'base_contact_by_functions_partner_firstname/res_partner.py'
--- base_contact_by_functions_partner_firstname/res_partner.py	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/res_partner.py	2014-01-30 15:45:21 +0000
@@ -0,0 +1,77 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2013 Savoir-faire Linux
+#    (<http://www.savoirfairelinux.com>).
+#
+#    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/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import orm, fields
+
+
+class res_partner(orm.Model):
+    """
+    Inherits partner and adds functions_ids : List of functions
+    """
+    _inherit = 'res.partner'
+
+    def create(self, cr, user, vals, context=None):
+        context = self._basecontact_check_context(cr, user, 'create', context)
+        if not vals.get('name') and vals.get('contact_id'):
+            vals['name'] = self.browse(cr, user, vals['contact_id'], context=context).name
+        if vals.get('end_date'):
+            if vals['end_date'] and vals['end_date'] <= time.strftime('%Y-%m-%d'):
+                vals['active'] = False
+        if vals.get('contact_type') and vals.get('contact_type') == 'standalone':
+            contact_vals = {key: vals[key] for key in vals.keys() if key != 'parent_id'}
+            contact_vals['active'] = True
+            contact_vals['function_id'] = None
+            vals['contact_id'] = super(res_partner, self).create(cr, user, contact_vals,
+                                                                 context=context)
+            name = vals['name'] if vals.get('name') else ''
+            firstname = vals['firstname'] if vals.get('firstname') else ''
+            fullname = firstname + '' + name
+            self.write(cr, user, vals['contact_id'],
+                       {'full_name': fullname}, context=context)
+        # Check if we create existing contact from company(ie: company is true)
+        # Check if we create another function from contact view
+        if vals.get('contact_type') == 'attached' or (not vals.get('contact_type') and vals.get('contact_id')):
+            contact_info = self.browse(cr, user, vals.get('contact_id'), context=context)
+            vals['firstname'] = contact_info.firstname
+            vals['title'] = contact_info.title or ''
+            vals['maiden_name'] = contact_info.maiden_name or ''
+
+        if 'reset_password' in context.keys() or 'install_mode' in context.keys():
+            return vals['contact_id']
+        res = super(res_partner, self).create(cr, user, vals, context=context)
+        return res
+
+    def write(self, cr, user, ids, vals, context=None):
+        context = self._basecontact_check_context(cr, user, 'write', context)
+        if vals.get('end_date'):
+            if vals['end_date'] and vals['end_date'] <= time.strftime('%Y-%m-%d'):
+                vals['active'] = False
+        if vals.get('contact_type') and vals.get('contact_type') == 'standalone':
+            contact_vals = {key: vals[key] for key in vals.keys() if key != 'parent_id'}
+            contact_vals['active'] = True
+            contact_vals['function_id'] = None
+            vals['contact_id'] = super(res_partner, self).write(cr, user, contact_vals,
+                                                                context=context)
+        return super(res_partner, self).write(cr, user, ids, vals, context=context)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_contact_by_functions_partner_firstname/res_partner_view.xml'
--- base_contact_by_functions_partner_firstname/res_partner_view.xml	1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/res_partner_view.xml	2014-01-30 15:45:21 +0000
@@ -0,0 +1,72 @@
+<?xml version = "1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+
+    <!--Redefine this part of view from firstname_partner module -->
+    <record id="view_partner_form_firstname_inherit11" model="ir.ui.view">
+      <field name="name">res.partner.form.firstname.inherit11</field>
+      <field name="model">res.partner</field>
+      <field name="inherit_id" ref="partner_firstname.view_partner_form_firstname"/>
+      <field name="arch" type="xml">
+        <!--Redefine firstname field in view partner-->
+        <field name="firstname" position="replace">
+          <group attrs="{'invisible': [('is_company', '=', True)]}">
+            <field name="firstname"/>
+          </group>
+        </field>
+        <!--Redefine firstname field in contact view-->
+        <xpath expr="//form[@string='Contact']/sheet/div//field[@name='firstname']" position="replace">
+          <field name="firstname" attrs="{'invisible': [('contact_type', '=', 'attached')]}"/>
+        </xpath>
+      </field>
+    </record>
+
+    <!--Replace name by full name in kanban view-->
+    <record id="view_partner_form_firstname_inherit11" model="ir.ui.view">
+      <field name="name">res.partner.form.firstname.inherit11</field>
+      <field name="model">res.partner</field>
+      <field name="inherit_id" ref="base_contact_by_functions.view_contact_by_function_form"/>
+      <field name="arch" type="xml">
+        <xpath expr="//field[@name='other_contact_history_ids']/kanban//field[@name='name']" position="replace">
+          <field name="full_name"/>
+        </xpath>
+        <xpath expr="//field[@name='other_contact_history_ids']/kanban/templates//t[@t-name='kanban-box']//div[@class='oe_kanban_details']//field[@name='name']"
+               position="before">
+          <field name="firstname"/>
+        </xpath>
+        <!--Display firstname and name after Image-->
+        <xpath expr="//field[@name='other_contact_history_ids']/form[@string='Contact']/sheet//field[@name='image']"
+               position="after">
+          <h1>
+            <field name="contact_id" style="width: 70%%" readonly="1"/>
+          </h1>
+        </xpath>
+      </field>
+    </record>
+
+     <!--Display firstname and name in kanban view for other position -->
+     <record id="view_partner_form_firstname_name" model="ir.ui.view">
+      <field name="name">res.partner.form.firstname.name</field>
+      <field name="model">res.partner</field>
+      <field name="inherit_id" ref="base_contact_by_functions.view_position_info_form"/>
+      <field name="arch" type="xml">
+        <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet/div//field[@name='name']"
+               position="replace"/>
+        <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet//field[@name='image']"
+               position="after">
+          <h1>
+            <field name="contact_id" style="width: 70%%" readonly="1"/>
+          </h1>
+        </xpath>
+        <!--I don't want to display the label field, so I hide it-->
+        <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet/div//label[@for='name']"
+               position="replace"/>
+        <!--Add firstname before name in templates view-->
+        <xpath expr="//t[@t-name='kanban-box']//div[@class='oe_kanban_details']/h4[@class='oe_partner_heading']//field[@name='name']"
+               position="before">
+          <field name="firstname"/>
+        </xpath>
+      </field>
+    </record>
+  </data>
+</openerp>