Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4474 มุมมอง

Hello,
I am currently facing an issue while attempting to migrate my database, I encountered the following error:

ValueError: Invalid field 'custom_field_name' on model 'model_name'


This error seems to be related to several custom fields, particularly One2many and Many2many fields that I have added in custom modules and it appears in several models. I have thoroughly verified the database, and the data exists. Additionally, there are no issues with the views.

Your help would be truly appreciated!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Two things pop up in my mind, first have you ensured that the module defining the custom_field_name is properly installed and that its dependencies are correctly set up? If your custom field is in a module that extends or depends on other modules, ensure those are loaded first.

Secondly, check the Python model where custom_field_name is defined. Ensure that the field is correctly declared and follows the correct syntax. For One2many and Many2many fields, ensure the relation and inverse names are correctly specified.


อวตาร
ละทิ้ง
ผู้เขียน

Indeed, the problem was in the non-installed dependencies. Thank you for pointing that out!

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มิ.ย. 22
4964
1
ก.ค. 25
2508
2
ก.ค. 25
7949
2
ก.ค. 25
4387
2
ก.ค. 25
4097