Skip to Content
Menu
This question has been flagged
3 Replies
1705 Views

So my problem is that i sometimes get the error "field does not exist in model" when i delete a field in both the python file and the view. I checked that there is no remaining reference to this field and the error i get says somewhere inside the view where i deleted the field. It seems that somehow the old view gets used while the new python file is used to start my odoo server.


I usually solve this error by creating a new database where everything runs fine but i want to solve it without creating a new database. I already tried to execute the reset_arch() function on the view, tried to unlink it with unlink(), delete the view and the field in the database but nothing worked.


Is there anything that could solve this?

Avatar
Discard
Best Answer

Hi,
If the database is accessible, you can navigate to the views folder and see if the field existing in any of the views of the corresponding model.

While searching in views, ensure to search inside View Architecture, if you find any views having the field, delete the usage of the field from the view.

If the above doesn't solve the case, consider upgrading module from command line.


Thanks

Avatar
Discard
Best Answer

Hello Fr4sha,


When deleting a field , you may notice that some data still remains, which can lead to errors.


To resolve this error, you can run the following command in the terminal:



  psql your_database_name



After that, enter the following command:


  ALTER TABLE table_name DROP COLUMN IF EXISTS column_name;


In this command, please replace table_name with the name of your model (remember to replace any periods with underscores) and column_name with the name of the field you want to delete.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Avatar
Discard
Best Answer

Make sure you removed the field from all templates, and functions or methods where you referenced it. 
A simple search could help you identify all the locations you've used your field. 

As a rule of thumb, make sure you are correctly updating the files you changed, when running the server. use "-u all" (update all)  just to be sure


Avatar
Discard
Related Posts Replies Views Activity
4
Dec 24
29710
1
Mar 15
4765
0
Mar 15
3043
1
Dec 24
862
1
Aug 24
1198