Skip to Content
Menu
This question has been flagged
3 Replies
3229 Views

i have created aa_openacademy folder on addons under that folder i create models folder and models.py inside with code shown below. my question is how they get the openacademy.course? i mean the openacademy where it came from?

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


from odoo import models, fields, api

     

class Course(models.Model):

    _name = 'openacademy.course'


    name = fields.Char(string="Title", required=True)

    description = fields.Text()     

    


Avatar
Discard

Hope this will helps you to create and install modules, models, views etc: https://plus.google.com/collection/4UX8UE

Best Answer

Hi louie,
You give a name(_name) odoo create a table with this name.

That is "openacademy.course" is a table name. If you are going to create your own module and you need to create a new table then give that table name in the python code.

like:

_name = 'openacademy.course'

For more please refer :

https://www.cybrosys.com/blog/how-create-module-odoo

This doc will understand to know more about the odoo structure.

https://www.odoo.com/documentation/11.0/reference/guidelines.html

Thanks

Avatar
Discard
Author

so that means. anything you can put it. its not referring to the folder or something?? so i can rename it anything what you want right?? thanks in advance

if you change any default odoo codes or tables name, then it may damage in your odoo application. so please make study well about it and you can create your own addons.

Author

hi thanks for rply. im referring only to this class

Course(models.Model):

_name = 'openacademy.course'

instead of that i will rename _name = 'nameoftable.coruse' im correct?

yes, it's fine. but you need to change over all the module from ""openacademy.course"" to ""ameoftable.coruse"" .

Author

thanks very much