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

Hi Experts

Its my first time to add a custom field in the form through the custom module. and i am facing this error

Field `custfield` does not exist

can you please guide me what i am doing wrong

here is my models directory codes

models\__init__.py  code

import custfield

models\custfield.py

from .import models, fields

class custfieldInherited(models.Model):

_inherit = 'fleet.vehicle'

custfield = fields.Char(string='Custom Field')


many thanks in advance.




อวตาร
ละทิ้ง

Hi, There is init file outside the models folder, check whether model is called in that init file

ผู้เขียน

Hi Niyas Raphy

init file outside the models folder have following code

import models

Please guide further what i am doing wrong.

คำตอบที่ดีที่สุด

Upgrade the module

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

how? can you guide please.

Add -u all to the command used to run the project

คำตอบที่ดีที่สุด

Try this :

change the line 'from .import models, fields' to

>> from odoo import  fields, models

Always Restart the server if you made a database change


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

thanks for the response. i have tried changing the code as you suggest but still there is no field added in the fleet.vehicle model. please note that i am working on windows. i have tried restarting services of odoo as well as operating system.

ผู้เขียน คำตอบที่ดีที่สุด

Hi Niyas Raphy

init file outside the models folder have following code

import models

Please guide further what i am doing wrong. 

@ Daniel John

Thanks for the reply. fleet module is already installed. In the manifest file it is also mentioned in the depends area that this custom module depends on the fleet module.


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

You need to install Fleet module first

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
เม.ย. 17
10070
4
ต.ค. 20
8687
3
ก.พ. 24
10153
1
พ.ย. 23
2635
1
มิ.ย. 23
3432