Odoo Help


[Solved] ERROR: Model 'training.custom' contains module data and cannot be removed!

on 5/19/15, 5:00 AM 2,647 views

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)



| 8 8 8

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

On 5/19/15, 5:04 AM

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.

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

on 5/19/15, 5:28 AM

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!

on 5/19/15, 5:36 AM

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?

on 5/19/15, 5:38 AM

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 :)

on 5/19/15, 5:48 AM

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

on 5/19/15, 5:53 AM

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

on 5/19/15, 5:55 AM

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

on 5/19/15, 5:59 AM

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.

on 5/19/15, 7:12 AM

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

on 5/20/15, 1:54 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/19/15, 5:00 AM
Seen: 2647 times
Last updated: 5/19/15, 5:58 AM