diff --git a/res_partner_affiliate/__init__.py b/res_partner_affiliate/__init__.py
new file mode 100644
index 000000000..d4d1e7592
--- /dev/null
+++ b/res_partner_affiliate/__init__.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Yannick Vaucher
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import res_partner
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/res_partner_affiliate/__openerp__.py b/res_partner_affiliate/__openerp__.py
new file mode 100644
index 000000000..016cc5925
--- /dev/null
+++ b/res_partner_affiliate/__openerp__.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Yannick Vaucher
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+{'name' : 'Partner Affilates',
+ 'version' : '1.0',
+ 'author' : 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'CRM',
+ 'complexity': "normal", # easy, normal, expert
+ 'depends' : ['base'],
+ 'description': """Allows to use parent_id in company partner to refer to a parent company
+ Plus will show a tab in parent company of affiliated companies""",
+ 'website': 'http://www.camptocamp.com',
+ 'init_xml': [],
+ 'update_xml': [
+ 'res_partner_view.xml',
+ ],
+ 'demo_xml': [],
+ 'tests': [],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'application': True}
+
diff --git a/res_partner_affiliate/res_partner.py b/res_partner_affiliate/res_partner.py
new file mode 100644
index 000000000..438f9a8e9
--- /dev/null
+++ b/res_partner_affiliate/res_partner.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Yannick Vaucher
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from openerp.osv import osv, fields
+
+class ResPartner(osv.osv):
+ """
+ Add relation affiliate_ids
+ """
+ _name = "res.partner"
+ _inherit = "res.partner"
+
+ _columns = {
+ 'child_ids': fields.one2many(
+ 'res.partner', 'parent_id',
+ 'Contacts', domain=[('is_company','=',False)]),
+ 'affiliate_ids': fields.one2many(
+ 'res.partner', 'parent_id',
+ 'Affiliates', domain=[('is_company','=', True)]),
+ #'lot_count': fields.function(_count_related, string="Lot", type='integer', multi='count_rel'),
+ }
diff --git a/res_partner_affiliate/res_partner_view.xml b/res_partner_affiliate/res_partner_view.xml
new file mode 100644
index 000000000..e5f0109f5
--- /dev/null
+++ b/res_partner_affiliate/res_partner_view.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+ res.partner.form
+ res.partner
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+