Odoo Warning “Perhaps a module was partially remov

2020-07-22 10:12发布

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""

标签: odoo-9
2条回答
爷的心禁止访问
2楼-- · 2020-07-22 10:53

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.

查看更多
Evening l夕情丶
3楼-- · 2020-07-22 10:55

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.

查看更多
登录 后发表回答