跳至內容
選單
此問題已被標幟
3 回覆
2515 瀏覽次數

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?

頭像
捨棄
最佳答案

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

頭像
捨棄
最佳答案

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

頭像
捨棄
最佳答案

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


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
4
12月 24
30792
1
3月 15
5329
0
3月 15
3592
1
7月 25
3271
1
12月 24
1530