Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3395 Переглядів

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



Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
3
лист. 24
29939
0
лип. 23
1825
1
черв. 23
7764
1
бер. 24
43593
2
серп. 22
2474