Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

4

About deprecated models in v7

By
Sudhir Arya (SA)
on 3/26/13, 4:14 AM 3,541 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?

+1 for nice question.

Sasuke
on 3/26/13, 4:20 AM
3

Nicolas Bessi

--Nicolas Bessi--
1590
| 5 7 8
Lausanne, Switzerland
--Nicolas Bessi--
Nicolas Bessi
On 3/26/13, 4:26 AM

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

patrick
on 3/26/13, 7:39 AM

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

Sudhir Arya (SA)
on 3/26/13, 9:11 AM

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

Camptocamp SA
on 3/26/13, 9:16 AM

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

Sudhir Arya (SA)
on 3/26/13, 9:22 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/26/13, 4:14 AM
Seen: 3541 times
Last updated: 7/22/16, 9:39 AM