Skip to Content
Menu
This question has been flagged
1 Reply
3090 Views

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
Discard
Author

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

Best Answer

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
Discard
Related Posts Replies Views Activity
3
Nov 24
28921
0
Jul 23
1508
1
Jun 23
7318
1
Mar 24
42894
2
Aug 22
2048