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.

5

What does OSV mean in OpenERP modules?

By
P Mittal
on 5/22/13, 10:42 PM 14,515 views

I came across the word "osv" in almost all the OpenERP modules. What does it stand for? Has it something to do with the OpenERP Object Relational Mapper?

6

Sandeep

--Sandeep--
6083
| 6 5 8
Delhi, India
--Sandeep--
Python OpenERP Developer http://in.linkedin.com/pub/sandeep-rana/3b/a16/786/
Sandeep
On 5/23/13, 2:59 AM

Hi Mr. Mittal

osv is a class and an OpenERP descriptor class and all the class( model) must inherit it for OpenERP module deployment.

osv class inside in OSV module in OpenERP server , which content all the OpenERP properties like you can see _column, _defaults and other many things there such as name etc so we must inherit in our openerp model (class)

Thanks
sandeep

6

Andreas Maertens

--Andreas Maertens--
912
| 5 5 7
Finsterwalde, Germany
--Andreas Maertens--

I develop odoo8.0 modules

Andreas Maertens
On 5/23/13, 4:32 AM

As I tried to find out I came along one site:

http://members.hellug.gr/xrg/openerp-doc/html/api_reference/osv/osv.html

There they say: osv = "Objects Services"

It just points to the orm classes.

source: osv.py in server/openerp/osv/osv.py

from openerp.osv.orm import MetaModel, Model, TransientModel, AbstractModel
...
# deprecated - for backward compatibility.
osv = Model
osv_memory = TransientModel
osv_abstract = AbstractModel # ;-)

So you could also use orm.Model to create addons. It's the same. ;)

0

Brett Lehrer

--Brett Lehrer--
1252
| 5 4 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 5/23/13, 3:00 AM

OSV = Object Service

Keeps the definitions of objects and their fields in memory, more or less.

i saw class previously is osv.osv , now is osv.Model , so the later version for new class should begin with osv.Model ?

kalmenchia
on 5/23/13, 3:29 AM

That does work, and seems to be the direction they're pushing, but be careful about inheritance in 7.0 at least. I've noticed issues when trying to inherit, for example, an osv.osv_memory class with an osv.TransientModel class. As long as you're consistent you should be fine.

Brett Lehrer
on 5/23/13, 3:42 AM

That answers it well. Yes, I also see osv.Model used sometimes where I thought osv.osv should be used. Where can I get a list of all the classes and functions available under "osv" along with what they could be used for. (Reading the osv code for that is one option I have, but I would prefer if I could get some straight docs.)

P Mittal
on 5/23/13, 5:02 PM

As of just this morning, OpenERP has rolled out an update to their trunk documentation, available here: https://doc.openerp.com/trunk. The page specifically covering object and field functions is here: https://doc.openerp.com/trunk/server/03_module_dev_02

Most OSV functions are actually in orm.py. osv.py is pretty slim and just wraps the execution of actions so that if an error is raised in the middle of an action, the database can be rolled back to it's state prior, avoiding partial records from being written to the database.

Brett Lehrer
on 5/23/13, 5:57 PM

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

0 follower(s)

Stats

Asked: 5/22/13, 10:42 PM
Seen: 14515 times
Last updated: 11/4/15, 2:03 AM