Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
13421 Lượt xem

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?

 

 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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):

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 23
2432
4
thg 11 20
6688
1
thg 3 19
3352
0
thg 3 15
4081
1
thg 3 15
7322