0

I created a field in the model and its view, tested it and it worked. Then later deleted it, including in the database. When I created another field and restarted the system, it's generating an error saying the field I deleted perviously was referenced somewhere when I'm very sure it has been removed completely. I think the system is storing the cache information somewhere and I really don't know how to get rid of it.

asked Jan 24, 2025 at 5:15

1 Answer 1

0

Most probably, this is caused by the field is still registered in the table of ir_model_fields.
You need to check that table and manually delete your custom field from there.

These are the ways to do that:

  1. Get into the database, either by using psql through terminal, or PGAdmin software, or Query Deluxe (an Odoo module made by Yvan Dotet where you can access sql from inside Odoo db by query)
  2. No matter which method you use from first step above, then you need to start checking the 'ir_model' first, in which model you put your custom field (select * from ir_model where name = 'model_name';) where 'model_name' is the technical name of the model of your custom field
  3. After you get the id of the model, then do the query to check from ir_model_fields (select * from ir_model_fields where model_id = 'model_id';) then use the query to delete your custom field (delete from ir_model_fields where model_id = 'model_id' and name = 'field_name';)

Finally, don't forget to restart your Odoo service, upgrade the module where the model resides in, and do logout-login from the corresponding database.

That's all for you now, hope it helps!

References:

  1. ERROR: module cannot be deleted
  2. Why model is still there even after deletion?
  3. Custom field cannot be deleted
answered Jan 27, 2025 at 2:08
Sign up to request clarification or add additional context in comments.

1 Comment

@farisfath24 Thanks for your response! I have deleted the fields and restarted the computer, when I tried opening the product form, it's telling me it the fields still exist in the view, when I know I have remove them from product_view.xml. I think there is something I need to clear.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.