Odoo Help

Welcome!

This community 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.

0

New v8 API question

By
Antonio
on 7/7/14, 4:08 PM 1,812 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

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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