تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6874 أدوات العرض

Odoo 12 Community Edition
Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-72-generic x86_64)

I've downgraded an Odoo instance from 11e to 11ce and then migrated it to 12ce using OCA Open Upgrade and have a problem with leftover data.

While I've deleted the app "Helpdesk" and related modules, helpdesk_sale_timesheet and helpdesk_timesheet, they still appear in the data.

For instance​. the model helpdesk.ticket still exists in the database, and I cannot delete it because:

Model 'Ticket' co​ntains module data and cannot be removed.

This is also breaking the Discuss (mail) app as I cannot go to the Discuss page.  Error:

```

Error:

Odoo Server Error


Traceback (most recent call last):

  File "/opt/odoo12/odoo/odoo/http.py", line 656, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/opt/odoo12/odoo/odoo/http.py", line 314, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/opt/odoo12/odoo/odoo/tools/pycompat.py", line 87, in reraise

    raise value

  File "/opt/odoo12/odoo/odoo/http.py", line 698, in dispatch

    result = self._call_function(**self.params)

  File "/opt/odoo12/odoo/odoo/http.py", line 346, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/opt/odoo12/odoo/odoo/service/model.py", line 97, in wrapper

    return f(dbname, *args, **kwargs)

  File "/opt/odoo12/odoo/odoo/http.py", line 339, in checked_call

    result = self.endpoint(*a, **kw)

  File "/opt/odoo12/odoo/odoo/http.py", line 941, in __call__

    return self.method(*args, **kw)

  File "/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap

    response = f(*args, **kw)

  File "/opt/odoo12/odoo-custom-addons/mail_tracking/controllers/main.py", line 91, in mail_init_messaging

    values = super().mail_init_messaging()

  File "/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap

    response = f(*args, **kw)

  File "/opt/odoo12/odoo/addons/mail/controllers/main.py", line 243, in mail_init_messaging

    'mail_failures': request.env['mail.message'].message_fetch_failed(),

  File "/opt/odoo12/odoo/addons/mail/models/mail_message.py", line 422, in message_fetch_failed

    return messages._format_mail_failures()

  File "/opt/odoo12/odoo/addons/mail/models/mail_message.py", line 544, in _format_mail_failures

    record = self.env[message.model].browse(message.res_id)

  File "/opt/odoo12/odoo/odoo/api.py", line 831, in __getitem__

    return self.registry[model_name]._browse((), self)

  File "/opt/odoo12/odoo/odoo/modules/registry.py", line 176, in __getitem__

    return self.models[model_name]

KeyError: 'helpdesk.ticket'

```

I've taken the following steps to try and remove this data:

  • Removed the module directories from the server

  • ./odoo-bin --update all

  • service odoo restart -u all

  • Apps -> List mode -> Checkbox -> Delete for helpdesk

  • Remove and reinstall Discuss (mail)


What else can I do?







الصورة الرمزية
إهمال
أفضل إجابة

I would try deleting mail.message records linked to the helpdesk.ticket model - the error indicates the custom mail_tracking module is triggering the error and I suspect it is trying to do something with messages linked to the helpdesk App.

الصورة الرمزية
إهمال
الكاتب

How? I get the above error if I try to delete them. Is there a way to do it directly in the database (making sure you get everything)?

Try: DELETE FROM MAIL.MESSAGE WHERE MODEL = 'helpdesk.ticket';

الكاتب

Seems to have worked. Thank you!

الكاتب

Although mail_message (for those needing this).

OCA has some great tools for data cleaning and cleaning up apps too by the way. Adding it as a reference here. See https://www.odoo.com/apps/modules/12.0/database_cleanup/

الكاتب

Thank you, Yenthe. That's a great tool!

As Yenthe said, the OCA DatabaseCleanUp module does the job, but what is the right way to remove totally a custom model without using this kind of "Emergency" cleanup module ?

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يوليو 21
10302
1
يوليو 19
3406
0
مارس 23
2253
0
يوليو 22
1766
1
يوليو 21
7435