Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
19998 Vues

Really need help here..

I created this view and it didn't work out how I expected so I deleted it (along with the class in python) and now I cannot uninstall or reinstall the module as it is looking to this view.

I tried to delete from Odoo but got the error above. Can anyone help me remove this view?  (In a new DB this view does not exist)

Avatar
Ignorer
Meilleure réponse

I don't know if you still need to solve this, but you can try executing sql queries.

  1. Log into SQL Shell (psql)

  2. select * from ir_model where name  = 'model_name';

  3. delete from ir_model_fields where model_id = 'model_id';

  4. delete from ir_model where id = 'model_id';

Avatar
Ignorer
Meilleure réponse

Hi Siobhan,

I sometimes run in to this issue too and it can be annoying. The easiest way is to simply delete the whole module (folder) that is under addons. After removing the module you'll have to update the whole database by re-starting your Odoo service. Do this as follows:

./odoo.py -u all 

Everything will be re-checked and loaded and your module should be gone.

Avatar
Ignorer
Auteur

Thank you.. is there a way just to delete this view and keep the module?

You can 'always' remove a view by simply removing it from the XML file. The problem is that you've dropped your class, which contained the logic for your model (and database fields) and this is what triggered your module to the state where you couldn't update or delete the module. As long as you simply remove views in XML you shouldn't have any problems. Be careful when you delete classes though!

Auteur

ah ok... I deleted both as it wasn't working they way I thought it would. So the problem is with the class removal not the view?

Usually a view can't give you any problems, since you're simply calling the data from the model and fields. I haven't ever had problems with those 'freezing' the whole module. When you've removed that class from the module, and removing the fields/model from the database it tried to drop all those fields but they had data in it and Odoo was unable to delete those. So that got your module 'stuck' and recovering those problems is really annoying. By the way, just a tip, always try to develop on a test machine! In case you crash it its not too much of a problem :)

Auteur

Lucky for me I am on a test machine and that I saved the class (was going to tweak it later). I just readded them now and everything is running great.. Again Thank you

Its good to hear you still had the class, that makes things easier. No problem for the help, best of luck with the development!

Auteur

Just very quick question. How do you delete a class correctly or is that not possible?

I think you should first uninstall the module (when its still working, obviously), then remove the class and then re-install it. I'm not 100% sure on this though, since I never had to. But in theory that should work.

Auteur

In theory yes but in practice no.. You won't be able to uninstall the module without the missing class (That was my original problem). When I located the problem with uninstall, I couldn't delete the model. I will keep looking to see if there is a way as it seem a bit redundant to keep all the code just in case you need to uninstall a module

Hello @Yenthe Van Ginneken I have the same error "ERROR: Model '...' contains module data and cannot be removed!"

And I can't uninstall the module because of key error

I tried to "-u all" but it doesn't do anything...

Can you help me ?

Publications associées Réponses Vues Activité
2
juin 18
7175
1
févr. 24
1594
0
oct. 21
2142
2
janv. 20
8824
0
juin 19
4320