Context
I’m developing a custom Odoo module (v18) to extend the portal functionality for CRM, similar to how portal users can access Sales Orders or Invoices by default.
The goal is for portal users (non-internal, unlicensed) to:
- View and create CRM leads from the portal (/crm/my)
- Move leads through stages
- Have those leads visible to internal sales users inside the CRM pipeline.
Goal
Portal users can:
- Log in and see a “My Leads” section in their portal dashboard
- Create and update their leads through a form view
- Move their leads through stages
Internal users can:
- View all leads, including those created by portal users, inside the CRM module
Current Behavior
- Portal users can create leads — they show up under /crm/my and are stored in the database.
- Leads do not appear in the internal CRM pipeline, even when searching by record ID.
- In the backend, the Salesperson field (user_id) only shows internal users — not portal ones.
- The “My Leads” menu item also does not appear in the portal homepage, even though it’s defined in XML.
- Currently, the only way to reach the leads list is by manually entering the route /crm/my.
Implementation Overview
1️Portal Menu XML
<template id="inherit_portal_active_warning_my_home" inherit_id="portal.portal_my_home" name="Custom Portal Menus" priority="25" customize_show="True"> <xpath expr="//div[hasclass('o_portal_docs')]" position="inside"> <t t-call="portal.portal_docs_entry"> <t t-set="icon" t-value="'/crm/static/description/icon.png'"/> <t t-set="title">My Leads</t> <t t-set="url" t-value="'/crm/my'"/> <t t-set="text">View and create new leads</t> <t t-set="placeholder_count" t-value="'lead_count'"/> </t> </xpath> </template>
Expected behavior: “My Leads” should appear on the portal dashboard.
Actual behavior: It does not appear, though other portal menu entries do.
2️Custom Portal Group
<record id="group_portal_crm" model="res.groups"> <field name="name">Portal User - CRM Access</field> <field name="category_id" ref="base.module_category_hidden"/> </record>
3️Record Rules for CRM Lead Access
<!-- Portal users: can see their own or linked partner leads --> <record id="rule_crm_lead_portal_user" model="ir.rule"> <field name="name">CRM Lead: portal user allowed leads</field> <field name="model_id" ref="crm.model_crm_lead"/> <field name="domain_force">['|', ('partner_id','child_of', user.commercial_partner_id.id), ('create_uid', '=', user.id)]</field> <field name="groups" eval="[(4, ref('base.group_portal'))]"/> <field name="perm_read" eval="True"/> <field name="perm_write" eval="True"/> <field name="perm_create" eval="True"/> <field name="perm_unlink" eval="False"/> </record> <!-- Internal users: can see all leads --> <record id="rule_crm_lead_internal_all" model="ir.rule"> <field name="name">CRM Lead: internal users see all</field> <field name="model_id" ref="crm.model_crm_lead"/> <field name="domain_force">[(1, '=', 1)]</field> <field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]"/> <field name="perm_read" eval="True"/> <field name="perm_write" eval="True"/> <field name="perm_create" eval="True"/> <field name="perm_unlink" eval="True"/> </record>
Leads created by portal users appear fine on the portal side
Internal users still cannot see those same leads in the CRM pipeline.
4️Controller Snippet
From controllers/crm_lead.py:
@http.route(['/portal/crm_lead/create'], type='http', auth='user', methods=['POST'], csrf=False) def portal_crm_create(self, **post): user = request.env.user vals = { 'name': post.get('name') or 'New Lead', 'contact_name': post.get('contact_name') or '', 'email_from': post.get('email_from') or '', 'type': post.get('type') or 'lead', 'user_id': user.id, # Assign to portal user 'partner_id': user.partner_id.id, } lead = request.env['crm.lead'].create(vals) return request.redirect('/crm/my')
Lead is created successfully
Does not show up under the CRM app, even for Admin or Sales users.
Problem Summary
- Portal-created leads exist in the database but are invisible in the CRM backend.
- The “My Leads” portal menu does not appear on the dashboard.
- Salesperson field (user_id) only lists internal users — cannot assign a portal user.
My Questions
- 
How can I properly expose CRM leads to portal users so that:
- Portal users can see and manage only their own leads,
- Internal users can view all leads (including portal-created ones)?
 
- Why might the “My Leads” entry from my custom XML not appear on the portal homepage?
- Is there a safe way to allow portal users to be linked to leads (or even selectable in the Salesperson field) without converting them to internal users and consuming extra licenses?
- Are there specific wizards, views, or filters (like the user_id domain) in Odoo CRM that restrict visibility to internal users which I should override?



