[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#48813
X-original-commit: 80879be5d7ab863a097439df1cd61aa236edaca4
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# -*- 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
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# -*- 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()
|
||||
Reference in New Issue
Block a user