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

In v7, I found that there are some models which are deprecated.

I found three deprecated models in osv.

So it means that now onwards we should not use osv.osv, osv.osv_memory and osv.osv_abstract.

But I was surprised when I looked into the addons, osv.osv and osv.osv_memory are used.

So I am wondering why those models are deprecated?

อวตาร
ละทิ้ง

+1 for nice question.

คำตอบที่ดีที่สุด

Hello,

osv and osv_memory are just aliases to Model and TransientModel. They are still here for backward compatibility and will be supress with next release.

# deprecated - for backward compatibility.
osv = Model
osv_memory = TransientModel
osv_abstract = AbstractModel # ;-)

in osv code.

อวตาร
ละทิ้ง

So in my scripts I should use Model.osv when defining a new model? class my_object(osv.osv):

should be:

class my_object(Model.osv):

ผู้เขียน

Yes @patrick. You should use osv.Model instead of osv.osv and osv.TransientModel instead of osv.osv_memory.

In fact the recommended solution is from openerp.osv import orm, fields,... then do class X(orm.Model): class Y(orm.TransientModel):

ผู้เขียน

Yes. Instead of from osv or from toole, etc, we should use from openerp.osv or from openerp.tools, etc.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 24
8661
3
ก.ย. 24
20564
How to activate the Technical Features? แก้ไขแล้ว
5
ธ.ค. 24
51468
4
ก.ค. 24
9746
7
ส.ค. 23
10030