コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
13477 ビュー

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?

 

 

アバター
破棄
最善の回答

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.

関連投稿 返信 ビュー 活動
1
7月 23
2472
4
11月 20
6817
1
3月 19
3414
0
3月 15
4094
1
3月 15
7367