Crash when uninstalling module

Hi all,

I’ve been experimenting with a module to add some customizations to product information, including adding a binary file.

As I’ve been going through debug iterations, nearly every time I try to uninstall the module I get a dialog saying:
Connection lost
Trying to reconnect…

Once this happens, any attempt to re-connect to the server results in a 500 Internal Server Error.
“The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.”

The only way I’ve found to get the server to function afterward is to delete the database from the postgresql command line and start fresh.

The test module is simple.
File “manifest.py”

# -*- coding: utf-8 -*-
{
    'name': "product_template_error_barebones",

    'summary': """
        Investigate error in uninstalling modules.""",

    'description': """
        Investigate error in uninstalling modules.
    """,

    'author': "xxx",
    'website': "xxx.com",

    # Categories can be used to filter modules in modules listing
    # Check https://github.com/flectra/flectra/blob/master/flectra/addons/base/module/module_data.xml
    # for the full list
    'category': 'Uncategorized',
    'version': '0.1',

    # any module necessary for this one to work correctly
    'depends': ['base'],
}

File “init.py”

# -*- coding: utf-8 -*-
from . import models

File “models.py”

# -*- coding: utf-8 -*-

from flectra import models,fields

class product_document(models.Model):
    _inherit = 'product.template'
    file = fields.Binary(string="File:")

The error that shows up in the log is “TypeError: Model ‘product.template’ does not exist in registry”

Unfortunately, this is a fairly common problem in Flectra.
For me too, “The only way to get the server working after this is to delete the database from the postgresql command line and start over.”
It takes a lot of time and nerves.

Thanks for sharing your experience ObehObeh, it’s nice to know at least someone’s out there.

At this point, just starting the decision-making process of what system to use, about as much as I can say is that I’m glad I ran into these problems early on.

I have developed hundreds of flectra apps and never had this problem - if your code is okay.
As in your example code above the 'depends" in manifest file is set to base, but this is not correct. To enhance product.template module you need at least a dependency on product module. Otherwise your module is loaded before the product module (also when it is not installed) and this will break your flectra instance.

The depends section in manifest file is one of the most important!
When developing with pycharm I promise to use the PyCharm Odoo plugin. This plugin shows you if your dependencies are correct or not. This Plugin is working also nice with flectra and saved me a lot of time searching for (self made) errors…

1 Like