Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
3391 Näkymät

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
Hylkää
Tekijä

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

Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
3
marrask. 24
29939
0
heinäk. 23
1825
1
kesäk. 23
7763
1
maalisk. 24
43593
2
elok. 22
2474