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

When i am trying to create a new model, it does not creates and when i look on pycharm it is showing as missing model definition for my model in error. How to solve this issue

and here is my code


# -*- coding: utf-8 -*-
from
odoo_v16.odoo import fields, models


class HotelRooms(models.Model):
_name = "hotel.rooms"
_description = "Hotel Rooms"

name = fields.Integer(string="Room Number")


頭像
捨棄
作者

currently i am using windows operating system odoo_v16 is my environment, i can only import the fields and models through this statement, when i am using  from odoo import fields, models it's becoming an error



if its not a blocker, you can ignore and try

最佳答案

Hi Arjun,

In the above code you have shared, the issue related with the import statement

The correct import statement should be:

# -*- coding: utf-8 -*-

from odoo import fields, models



class HotelRooms(models.Model):

_name = "hotel.rooms"

_description = "Hotel Rooms"


name = fields.Integer(string="Room Number")



further more, you can refer this video for more detailed explanation on how to create new module, models, menus etc

How To Create Module In Odoo 16 || Create Models, Menus, Actions and Views || Odoo 16 Development


hope this will help you

thanks



頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
11月 24
29323
0
7月 23
1616
1
6月 23
7414
1
3月 24
43152
2
8月 22
2149