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

Odoo new Model class?

By
Andrius Laukavičius
on 7/28/14, 9:50 AM 3,975 views

Hello,

I saw these slides http://www.slideshare.net/openobject/odoo-from-v7-to-v8-the-new-api

And it uses this: `from odoo import Model, fields`

But if I write like that, I get this error:

 File "/home/user/openerp80/addons/hr_dc_extend/models/hr_contract.py", line 1, in <module>
    from odoo import Model, fields
ImportError: cannot import name Model

Also I didn't see any standard Odoo module us this new Model class even though they showed how to use it in slides. Is it not implemented yet or I need to do something more?

 

 

1

Ludo - Neobis

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

Developer

Ludo - Neobis
On 7/28/14, 10:43 AM

This is a typo in the slides. Use the following import instead:

from openerp import models, fields

or

from odoo import models, fields

On your class, use this:

class myclass(models.Model):

Your first suggested line works, but second suggestion, gives same error as using from slides.

NOD Baltic, UAB, Andrius Laukavičius
on 7/29/14, 1:32 AM

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

1 follower(s)

Stats

Asked: 7/28/14, 9:50 AM
Seen: 3975 times
Last updated: 3/16/15, 8:10 AM