Help

5

About deprecated models in v7

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 Comment
Avatar
Discard
Avatar
Sasuke
-

+1 for nice question.

1 Answer
3
Avatar
Nicolas Bessi
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.

4 Comments
Avatar
Discard
Avatar
patrick
-

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.

Avatar
Camptocamp SA
-

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.