Odoo Help

0

Module create new model - no table create

By
Bole
on 2/20/13, 6:01 AM 6,980 views

I'm trying to learn OpenERp code logic... I would like to write a new module, and need a new model created..

This is res_certificates.py code

from openerp.osv import fields, osv, orm
class res_certificates(osv.Model):
    _name='res_certificates'
    _description='Stored Certificates'
    _order='name'
    _columns = {
        'name': fields.char('Name', size=128, help="Internal name for certificate", reguired=True, select=True),
        'cert': fields.text('Certificate', help='Certificate (text)') ,
        'cert_password': fields.char('Certificate Password', size=64),
        'cert_key': fields.text('Private Key', help="Private key for user"),
        'key_password':fields.char('Private Key Password', size=64)

        }

res_certificates()

called from __init__.py as

import res_certificates

does not create any table table (note: at the moment i just need the table. no views) working on v7.0

If anyone could tell me what am i missing here??

Have you updated the module list and installed the module?

Andreas Brueckl
on 2/20/13, 6:30 AM

yes, modude is visible in the list, and install returns : openerp.modules.loading: module my_module: loading objects

Bole
on 2/20/13, 6:31 AM

can you try class res_certificates(osv.osv): ?

Juanjo Algaz
on 2/20/13, 6:52 AM

yes.. tried it olso.. but.. it should be the same.. because... in openerp.osv.osv lines 211-214 states: "# deprecated - for backward compatibility. osv = Model osv_memory = TransientModel osv_abstract = AbstractModel # ;-)"

Bole
on 2/20/13, 6:58 AM
2
Andreas Brueckl
On 2/20/13, 6:53 AM

Replace

_name='res_certificates'

with

_name='res.certificates'

Then restart and update the module again.

Here is the link to the Documentation of objects, fields and methods. However there is dedicated section for naming conventions.

jup.. works after restarting server...

Bole
on 2/20/13, 7:03 AM

would appriciate some usefull link on naming conventon here, because i saw in some modules naming _name='res_certificates' works fine???

Bole
on 2/20/13, 7:04 AM

The ORM converts the . to _ for you automatically when it names the new table.

Kelly Stuart
on 11/22/14, 2:17 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 2/20/13, 6:01 AM
Seen: 6980 times
Last updated: 3/16/15, 8:10 AM