Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
3394 Visninger

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")


Avatar
Kassér
Forfatter

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

Bedste svar

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



Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
3
nov. 24
29939
0
jul. 23
1825
1
jun. 23
7764
1
mar. 24
43593
2
aug. 22
2474