Skip to content
Snippets Groups Projects
Commit b9c180dd authored by Mitul Shah's avatar Mitul Shah
Browse files

[FIX] crm_iap_lead_website: properly handle 'lead_ids' on visitors


While installing 'crm_iap_lead_website' module, 'website_crm' module is
automatically installed(auto install based on website and crm), and it
introduces m2m field 'lead_ids' on visitors, as well as 'visitor_ids'
m2m on leads.

The issue is, 'website_crm' is installed automatically in this case,
but does not depend on 'crm_iap_lead_website', and one can therefore
uninstall 'website_crm' without knowing it may impact
'crm_iap_lead_website' (the 'lead_ids' field is defined in 'website_crm'
and it is used in 'crm_iap_lead_website', and so trying to access it
from 'crm_iap_lead_website' in this scenario will introduce a traceback).

Other point to note: as we have no visitor field available in
'crm_iap_lead_website' (many2many added in 'website_crm'), we cannot
manually search for leads as we do not have the information (we could
make a fallback on visitor.partner_id if set, but that would be much
low-level management just for a corner case).

Considering above points, to avoid the traceback, instead of directly
accessing the 'lead_ids' field, we simply check that whether the field
exists or not. If it does not exist, we simply consider that no leads
are attached to the visitor and we create the reveal view. If the field
is there, the flow remains the same.

Task-2655439

closes odoo/odoo#78355

Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent b1cb7816
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment