Skip to Content
Menu
This question has been flagged
1 Reply
8588 Views

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?

Avatar
Discard

+1 for nice question.

Best Answer

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.

Avatar
Discard

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

Author

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

Author

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

Related Posts Replies Views Activity
0
Dec 24
8607
3
Sep 24
20501
5
Dec 24
51375
4
Jul 24
9684
7
Aug 23
9961