diff --git a/addons/portal/portal_view.xml b/addons/portal/portal_view.xml
index 1b489d1e7b5..dc7a22a2f56 100644
--- a/addons/portal/portal_view.xml
+++ b/addons/portal/portal_view.xml
@@ -111,41 +111,6 @@ the portal's users.
-
-
-
-
-
@@ -167,7 +132,6 @@ the portal's users.
-
diff --git a/addons/portal_crm/__init__.py b/addons/portal_crm/__init__.py
new file mode 100644
index 00000000000..6b791be9f25
--- /dev/null
+++ b/addons/portal_crm/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 wizard
diff --git a/addons/portal_crm/__openerp__.py b/addons/portal_crm/__openerp__.py
new file mode 100644
index 00000000000..9af3df53442
--- /dev/null
+++ b/addons/portal_crm/__openerp__.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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': 'Portal CRM',
+ 'version': '0.1',
+ 'category': 'Tools',
+ 'complexity': "easy",
+ 'description': """
+ This module adds the menu if crm and portal are installed.
+ """,
+ 'author': 'OpenERP SA',
+ 'depends': ['crm','portal'],
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'wizard/contact_view.xml',
+ ],
+ 'installable': True,
+ 'auto_install':True,
+ 'category':'Hidden',
+
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/portal_crm/security/ir.model.access.csv b/addons/portal_crm/security/ir.model.access.csv
new file mode 100644
index 00000000000..08145a00f54
--- /dev/null
+++ b/addons/portal_crm/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+
diff --git a/addons/portal_crm/wizard/contact.py b/addons/portal_crm/wizard/contact.py
new file mode 100644
index 00000000000..74ebe11cd7f
--- /dev/null
+++ b/addons/portal_crm/wizard/contact.py
@@ -0,0 +1,40 @@
+from openerp.osv import osv, fields
+
+class crm_contact_us(osv.TransientModel):
+ """ Create new leads through the "contact us" form """
+ _name = 'portal_crm.crm_contact_us'
+ _description = 'Contact form for the portal'
+ _inherit = 'crm.lead'
+
+ def create(self, cr, uid, values, context=None):
+ """
+ Since they potentially sensitive, we don't want any user to be able to
+ read datas generated through this module. That's why we'll write those
+ information in the crm.lead table and leave blank entries in the
+ portal_crm.crm_contact_us table. This is why the create() method is
+ overridden.
+ """
+ crm_lead = self.pool.get('crm.lead')
+
+ """
+ Because of the complex inheritance of the crm.lead model and the other
+ models implied (like mail.thread, among others, that performs a read
+ when its create() method is called (in method message_get_subscribers()),
+ it is quite complicated to set proper rights for this object.
+ Therefore, user #1 will perform the creation until a better workaround
+ is figured out.
+ """
+ crm_lead.create(cr, 1, dict(values,create_uid=uid), context)
+
+ """ Create an empty record in the portal_crm.crm_contact_us table """
+ return super(crm_contact_us, self).create(cr, uid, {})
+
+ def submit(self, cr, uid, ids, context=None):
+ """ When the form is submitted, redirect the user to a "Thanks" message """
+ return {'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'view_type': 'form',
+ 'res_model': self._name,
+ 'res_id': ids[0],
+ 'view_id': self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal_crm', 'wizard_contact_form_view_thanks')[1]
+ }
diff --git a/addons/portal_crm/wizard/contact_view.xml b/addons/portal_crm/wizard/contact_view.xml
new file mode 100644
index 00000000000..c86efe81ca4
--- /dev/null
+++ b/addons/portal_crm/wizard/contact_view.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ Contact Us
+ portal_crm.crm_contact_us
+ form
+ inline
+
+
+
+
+
+
+
+ Wizard form view
+ portal_crm.crm_contact_us
+ form
+
+
+
+
+
+
+
+ Wizard thanks message
+ portal_crm.crm_contact_us
+ form
+
+ 99
+
+
+
+
+
+
+