Odoo Warning “Perhaps a module was partially removed or renamed”

拥有回忆 提交于 2019-12-22 10:29:45

问题


When I run odoo server, I got this warning message below.

WARNING dietfacts2 openerp.modules.loading: Model product.nutrientitem is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)

I know that it shows this warning message because I created the model name but then I changed it afterward. The model was saved to postgres DB. I tried to delete the table in DB but unsuccessful.

dietfacts2=# delete from ir_model where model = 'product.nutrientitem'; ERROR: null value in column "model" violates not-null constraint DETAIL: Failing row contains (1011, 2017-02-20 04:15:05.207869, 2017-02-20 04:15:05.207869, 285, null, f, false, product_nutrientitem_write_uid_fkey, null, null, null, null). CONTEXT: SQL statement "UPDATE ONLY "public"."ir_model_constraint" SET "model" = NULL WHERE $1 OPERATOR(pg_catalog.=) "model""


回答1:


Likely you have data in other tables that needs to be cleared first. Try ir_model_data

DELETE FROM ir_model_data WHERE model = 'your.model';

Then you should be able to delete your table. If you have constraints related to your table you may need to identify these and remove them as well.




回答2:


You have stale model data in your db. Usually is due to a model that has been removed/renamed or a module not uninstalled properly.

A useful module to handle these situations:

https://github.com/OCA/server-tools/tree/11.0/database_cleanup

https://www.odoo.com/apps/modules/11.0/database_cleanup/

It allows you to purge stale data for models, actions, etc, whatever "orphan" record is still in your db. You'll find a control panel for database cleanup under technical section.



来源:https://stackoverflow.com/questions/42357362/odoo-warning-perhaps-a-module-was-partially-removed-or-renamed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!