Ahrimann Steiner
Ahrimann Steiner

Reputation: 1334

Odoo v13 : Could not uninstall crm App : Record does not exist or has been deleted (Record: ir.model.fields(9311,), User: 1)

Odoo Version : 13.0.20210614

Way to Reproduce : in Application, CRM App. > uninstall

Behavior : image 1 in attach Can t Unsintall : ERROR (image 1 in attach): ('Record does not exist or has been deleted (Record: ir.model.fields(9311,), User: 1)', None) enter image description here Same Bug was reported several times but still not fixed :

https://github.com/odoo/odoo/issues/38008

enter image description here How to deal with it to uninstall the crm App ?

**************** TRACEBACK **************

2021-06-18 14:21:52,779 6 INFO samadeva-oerp-brstaging-2702918 odoo.addons.base.models.ir_module: ALLOW access to module.module_uninstall on ['sale_crm', 'crm_enterprise', 'crm_sms', 'website_crm', 'website_crm_sms', 'mass_mailing_crm', 'crm'] to user __system__ #1 via 86.243.106.83 

2021-06-18 14:21:52,800 6 WARNING samadeva-oerp-brstaging-2702918 odoo.modules.loading: Transient module states were reset 

2021-06-18 14:21:52,801 6 ERROR samadeva-oerp-brstaging-2702918 odoo.modules.registry: Failed to load registry 
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/api.py", line 745, in get
def get(self, record, field, default=NOTHING):
value = self._data[field][record._ids[0]]
KeyError: 9311

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/odoo/src/odoo/odoo/fields.py", line 1037, in __get__
value = env.cache.get(record, self)

File "/home/odoo/src/odoo/odoo/api.py", line 751, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.model.fields(9311,).model', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/odoo/src/odoo/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 494, in load_modules
Module.browse(modules_to_remove.values()).module_uninstall()

File "<decorator-gen-61>", line 2, in module_uninstall

File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 73, in check_and_log
return method(self, *args, **kwargs)

File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 478, in module_uninstall
self.env['ir.model.data']._module_data_uninstall(modules_to_remove)

File "/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 1898, in _module_data_uninstall
model = self.pool.get(ir_field.model)
File "/home/odoo/src/odoo/odoo/fields.py", line 1050, in __get__
_("(Record: %s, User: %s)") % (record, env.uid),
odoo.exceptions.MissingError: ('Record does not exist or has been deleted (Record: ir.model.fields(9311,), User: 1)', None)

Upvotes: 1

Views: 1360

Answers (2)

Ahrimann Steiner
Ahrimann Steiner

Reputation: 1334

My inspection of the cause of this error triggered by Click on uninstall crm module shows me that the database table ir_model_data had a record (fk : res_id=9311) pointing to the other table ir_model_fields, where the corresponding pk id is missing (no record having pk : id=9311). To be able to uninstall the crm App, the only solution that i have found - after searching for hours to solve it using the odoo way - was to delete the "orphan" record in ir_model_data. i had to fire the deletion by puting this line in a self executed cron-Action :

self.env['ir.model.data'].search([('res_id','=',9311)],limit=1).unlink()

Upvotes: 2

 eurodoo Eurodoocom
eurodoo Eurodoocom

Reputation: 11

i have same problem and solved it witout code. Enable develop mode. Go to Settings->External Identifiers and find model = 'ir.model.fields' and res_id = and delete it

Upvotes: 1

Related Questions