Skip to content
Snippets Groups Projects
Commit 80879be5 authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] crm_iap_lead, crm_iap_lead_enrich: Uninstalling CRM

Steps to reproduce the bug:

- Let's consider an instance with crm_iap_lead and crm_iap_lead_enrich installed
- Uninstall crm

Bug:

An error was raised: ('Record does not exist or has been deleted.\n(Record: ir.model.fields(15085,), User: 1)', None)
because the field reveal_id is shared on model crm.lead and modules crm_iap_lead and crm_iap_lead_enrich are independent
from each other.

Inspired from https://github.com/odoo/odoo/commit/ff7efbb1e81cd6987601c03f0b75a37d2df8e331



opw:2224952

closes odoo/odoo#48658

Signed-off-by: default avatarSimon Goffin (sig) <sig@openerp.com>
parent fe8c409e
No related branches found
No related tags found
No related merge requests found
......@@ -4,3 +4,4 @@ from . import crm_lead
from . import crm_iap_lead
from . import crm_iap_lead_helpers
from . import crm_iap_lead_mining_request
from . import ir_model_fields
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details
from odoo import models
class IrModelFields(models.Model):
_inherit = 'ir.model.fields'
def unlink(self):
# Nasty hack to prevent the deletion of shared field reveal_id
self = self.filtered(
lambda rec: not (
rec.model == 'crm.lead'
and rec.name == 'reveal_id'
)
)
return super(IrModelFields, self).unlink()
......@@ -4,3 +4,4 @@
from . import crm_lead
from . import iap_enrich_api
from . import res_config_settings
from . import ir_model_fields
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details
from odoo import models
class IrModelFields(models.Model):
_inherit = 'ir.model.fields'
def unlink(self):
# Nasty hack to prevent the deletion of shared field reveal_id
self = self.filtered(
lambda rec: not (
rec.model == 'crm.lead'
and rec.name == 'reveal_id'
)
)
return super(IrModelFields, self).unlink()
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