Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
7 Trả lời
9648 Lượt xem

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.




Ảnh đại diện
Huỷ bỏ

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

Tác giả

Hi Niyas Raphy

init file outside the models folder have following code

import models

Please guide further what i am doing wrong.

Câu trả lời hay nhất

Upgrade the module

Ảnh đại diện
Huỷ bỏ
Tác giả

how? can you guide please.

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

Câu trả lời hay nhất

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


Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Tác giả Câu trả lời hay nhất

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.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You need to install Fleet module first

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 4 17
10070
4
thg 10 20
8685
3
thg 2 24
10153
1
thg 11 23
2634
1
thg 6 23
3431