Odoo Help

Welcome!

This community 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.

0

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

By
Siobhan
on 5/19/15, 5:00 AM 1,376 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)

1

Yenthe

--Yenthe--
6676
| 7 7 8
Turnhout, Belgium
--Yenthe--

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

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

Yenthe
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?

Siobhan
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!

Yenthe
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?

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

Yenthe
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

Siobhan
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!

Yenthe
on 5/19/15, 5:55 AM

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

Siobhan
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.

Yenthe
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

Siobhan
on 5/20/15, 1:54 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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