Odoo Help

0

New v8 API question

By
Antonio
on 7/7/14, 4:08 PM 2,120 views

I am trying create a module with the new v8 API. I followed the Odoo days slide (http://es.slideshare.net/openobject/odoo-from-v7-to-v8-the-new-api) and it doesn't work. 

What am I doing wrong?

################## CODE ##############

# from odooo import Model, fields  # Don't work!!!!!


### is this correct?
from openerp import fields
from openerp import models


class Plataforma(models.Model):
    _name = 'ldm.plataforma'

# No errors. Create the models but no create the fields.
    name = fields.Char(string='Platform', required=True)
    description = fields.Text()

Plataforma()

Ok. I just upgraded and now works. :D thank you very much

Antonio
on 7/8/14, 12:01 PM
0
Antonio
On 7/8/14, 2:37 AM

Hello Antonio, Did you mentioned the name of this file under "__init__.py" file, which initializes the content of this file. Please check that. Code looks ok.

Hello Hiren, my __init__.py #### CODE ##### import devices.py odoo loads the module because the model appears in the database. The problem is that the fields do not appear (only appears the defaults fields.. write_uid, create_uid...) Thanks

Antonio
on 7/8/14, 2:41 AM

It is quite strange becuase the model exits but not the fields... :(

Antonio
on 7/8/14, 11:54 AM
0
Ludo - Neobis
On 7/8/14, 5:10 AM

Current account module for 8.0 branch uses this import for starters:

from openerp import models, fields, api, _

The field definition seems oke. You do not seem to import the api, so I assume that you do not use the methods just yet?

0
Bevan Weiss
On 7/25/14, 6:50 AM

Try

    from openerp import models, fields, api

    class Plataforma(models.Model):

        _name = 'ldm.plataforma'

        name = fields.Char(string='Platform', required=True)
        description = fields.Text()

 

The account_invoice module has been the only thing I can find using the v8 api at this stage.  I'm trying to convert my module to this also, but struggling to get a fields.One2many(related='...') to work where it has an additional layer of indirection.

I hope more examples start to appear soon...

 

Bevan

0
Fekete Mihai
On 7/25/14, 6:57 AM

I had the same problem with the new api, the ideea is that you will have to put first the string=" " attribute, and after to put the related one.

I didn't define any text fields..so probably that what are you missing...probably you will have to put the string attribute there too.

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

2 follower(s)

Stats

Asked: 7/7/14, 4:08 PM
Seen: 2120 times
Last updated: 3/16/15, 8:10 AM