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