Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
13449 มุมมอง

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 23
2465
4
พ.ย. 20
6767
Why can't i find some models in db? แก้ไขแล้ว
1
มี.ค. 19
3392
0
มี.ค. 15
4092
1
มี.ค. 15
7359